Hi all,
i’m trying to reproduce the collapsed “if” loops in Scala.
This is what I mean:
Collapsed “if” loop, at least as I’m tryng to reproduce the Java one:
val length : Int = 1;
val s : String = “s”;
return (length == s.length()) ? length : (length + 1);
But, using scala I get this error:
error: identifier expected but integer literal found.
return (length == s.length()) ? length : (length + 1);
So, please whch is the correct syntax of the collapsed “if” loop in scala?
Thank you.