I have the following two lists , I am not sure if at run time list2 will be empty or full , but list1 will be always non empty, how to ensure that for the following for loop value of list are at least printed
val list1 = List(1,2,3) //> list1 : List[Int] = List(1, 2, 3)
val list2 = List() //> list2 : List[Nothing] = List()
for( counti <- list1 ; countj <- list2 ) yield println (counti + " - " + countj)
//> res7: List[Unit] = List()
I am expecting something like
1 - BLANK
2 - BLANK
3 - BLANK
but above for loop is giving me blank results List()
1 Answer