99 Bottles of Beer/Scala: Difference between revisions

ParRange
(moved from 99 Bottles of Beer)
 
(ParRange)
Line 3:
 
<lang scala>99 to 1 by -1 foreach {n =>
println("""|%d bottles of beer on the wall
|%d bottles of beer
|Take one down, pass it around
|%d bottles of beer on the wall\n""".stripMargin format (n, n, n -1))}</lang>
 
The above running in paralell using a ParRange
 
<lang scala>(99 to 1 by -1).par foreach {n =>
println("""|%d bottles of beer on the wall
|%d bottles of beer
Anonymous user