I’m having a problem with the scripting engine, wh...
# scripting
c
I’m having a problem with the scripting engine, which I’m using for a simple REPL. Here’s a repro of what I’m seeing:
Copy code
val engine = ScriptEngineManager().getEngineByExtension("main.kts")!!
    println(engine.eval("if (true) { 2 } else { 3 }"))
    println(engine.eval("if (true) 2 else 3"))
This prints:
Copy code
0
2
So the conditional returns an incorrect value if the then and else terms have braces around them. I’ve tested this with both the “main.kts” and “kts” engines, and with 1.9.23 and 2.0.0-RC1. Am I misunderstanding something about how this should work?