99 Bottles of Beer/Scala: Difference between revisions
Content added Content deleted
(moved from 99 Bottles of Beer) |
(ParRange) |
||
Line 3: | Line 3: | ||
<lang scala>99 to 1 by -1 foreach {n => |
<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 |
println("""|%d bottles of beer on the wall |
||
|%d bottles of beer |
|%d bottles of beer |