Last active
January 4, 2021 19:34
-
-
Save Moverr/3980cdf983f00ffa3d90605f89f0b49d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object loops { | |
def isEven(number: Int) = number % 2 == 0 | |
def main(args: Array[String]): Unit = { | |
val list = List(1, 2, 3, 4, 5) | |
list.foreach(x => if(isEven(x)) println(x) ) | |
//todo multiple levels of itereation | |
val firstList = List('A', 'B', 'C') | |
val secondList = List("XA", "yA", "ZA") | |
firstList.foreach(first => secondList.foreach(second => println(first.toString + second))) | |
println("Interesting") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
object loops {
def main(args: Array[String]): Unit = {
}