6. [Exercise] Flow Control in Scala
Activity
For this activity, go ahead and import from the resource the file LearningScala2.scala
For Scala, we can control the flow of code
For example, if and else control flow in 1 line using Functional Programming
You can also use if and else condition with {} syntax
You can also use case match for certain cases
This is the syntax for For Loop in Scala
This is the syntax for While Loop in Scala
This is the syntax for Do While Loop in Scala in 1 line using Functional Programming
In Scala, you can print the result returned by the expression, even while not assigning any val to it
Exercise
Last updated