For Loop in Scala - GeeksforGeeks
www.geeksforgeeks.org › for-loop-in-scalaJul 20, 2021 · In Scala, for-loop allows you to filter some elements from the given collection using one or more if statements in for-loop. Syntax: for (i<- List if condition1; if condition2; if condition3; ...) { // code.. } Example: Scala object Main { def main (args: Array [String]) { var rank = 0; val ranklist = List (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);