What Happens?
- Thunks: pass-by-name for explicit nonstrict evaluation of function arguments
- def fcond(b: Boolean, t: => Int, f: => Int) : Int =
- if b then t else f
- for i <- 1 to 10 do
- val z = fcond(scala.util.Random.nextInt % 2 == 0,
- f(),
- g())
- println(s"z=$z")
- Thunks are parameterless functions