javax.script支持

Kotlin集成了javax.script API,这些API允许在运行时计算值。

val engine = ScriptEngineManager().getEngineByExtension("kts")!!
engine.eval("val x = 3")
println(engine.eval("x + 2")) // Prints out 5

results matching ""

    No results matching ""