20 If

Conditions are almost the same as in imperative languages such as Java or C. However one important thing to remember in Scala, is that everything is an expression, even an if block.

The ternary operator (condition ? truePart : falsePart) in Scala is simply if (condition) truePart else falsePart


Code editor is using Scalakata.com written by Guillaume Massé