Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
5
Task/Loops-Do-while/Scala/loops-do-while-3.scala
Normal file
5
Task/Loops-Do-while/Scala/loops-do-while-3.scala
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def loop(i: Int, cond: (Int) => Boolean): Stream[Int] = {
|
||||
val succ = i + 1;
|
||||
succ #:: (if (cond(succ)) loop(succ, cond) else Stream.empty)
|
||||
}
|
||||
loop(0, (_ % 6 != 0)).foreach(println(_))
|
||||
Loading…
Add table
Add a link
Reference in a new issue