Practice 11.05.2022

Run Settings
LanguageScala
Language Version
Run Command
object Main extends App { val lst = List(2,9,3,44,22,18,11,8) val res = for (i <- lst; if i < 15) yield { i+5 } println(res) val name = List("nemo","dori","stud") val res2 = for(i <- name; if i == "dori") yield { i + " has been found" } println(res2.toString()) val age = 50 val res3 = age match { case 10 => age case 20 => age case 50 => age case _ => "Default" } println("The age of the lady is : " + res3) val number = 6 val res4 = number match { case 1 | 3 | 5 | 7 | 9 => println(s"The number $number is Odd") case 2 | 4 | 6 | 8 => println(s"The number $number is Even") } def multiply(x:Int,y:Int) = x*y println( "The multiplication checker : " + multiply (5,9)) val res5 = (x:Int, y:Int) => x+y println(res5(2,3)) }
Editor Settings
Theme
Key bindings
Full width
Lines