scastie
scastie copied to clipboard
Multiple lines of code after an if comparison doesn't work as expected
According to the official Scala 3 book, this should be a valid syntax:
val x = 1
if x == 1 then
println("x is 1, as you can see:")
println(x)
else
println("x was not 1")
But pasting this in Scastie will get an error "end of statement expected but 'else' found" https://scastie.scala-lang.org/iJkk0GGTQt6sMwz2cgf2Cg
Hey, thanks for reporting. The new syntax braceless is not yet supported by worksheet mode. It is going to change in the near future. If you run this snippet without worksheet mode, it should properly compile.