println( "there are 7 numbers 8 in 2 here"
.toList.filter(Character.isDigit) )
Load the first word only.
println(("first word only".toList.takeWhile(c => c != ' ') ).mkString)
println( "there are 7 numbers 8 in 2 here"
.toList.filter(Character.isDigit) )
println(("first word only".toList.takeWhile(c => c != ' ') ).mkString)
def looping() = {
val myList = (1 to 20 by 3)
println(myList)
val list2 = for( i <- myList if i % 2 == 0 ) yield i
println(list2)
}
def flatten3(l: List[_]): List[_] = {
l.flatMap(a => {
if (a.isInstanceOf[List[_]]) flatten3(a.asInstanceOf[List[_]])
else List(a)
})
}