Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple lines of code after an if comparison doesn't work as expected #886

Open
pishen opened this issue Jun 26, 2023 · 1 comment
Open

Comments

@pishen
Copy link

pishen commented Jun 26, 2023

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

Screenshot 2023-06-26 at 8 49 53 AM
@rochala
Copy link
Collaborator

rochala commented Jun 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants