Home »
Code Examples »
Scala Code Examples
Scala - A Simple Match Code Example
The code for A Simple Match
val bools_value = List(true, false)
for (bool <- bools_value) {
bool match {
case true => println("It is true.")
case false => println("It is false.")
case _ => println("Other than true and false")
}
}
/*
Output:
It is true.
It is false.
*/
Code by IncludeHelp,
on August 7, 2022 17:39