Relative Content

Tag Archive for scalascala-3

new syntax (indentation) doesn’t allow if statement

Here is my code. The idea is that the grades go from 0-5 and it cannot go higher, thus the if command.
Highlighted in the code is the part that apparently is not allowed anymore (grade > 5)- I get a syntax error that says: “This construct is not allowed under -new-syntax.”

Is there a syntax for varargs splicing compatible with both Scala 2 and Scala 3?

Context One of the differences between Scala 2 and Scala 3 is the syntax for varargs splices. So given def combine(strings: String*): Unit = { println(strings.mkString(“; “)) } val list = List(“a”, “b”) In Scala 2 one can call the function with: combine((list ++ list): _*) In Scala 3 the syntax is: combine((list ++ list)*) […]