m_vmvq
Last Updated: February 25, 2016
·
113
· amirtcheva
Dd1ca1288610b1750af31b0f22a51d6c

Foreach and counting in Scala

Was looking for the equivalent of Ruby's:
ruby (1..5).each {|x| puts x }
or:
ruby (1.upto(5)).each {|x| puts x}

in Scala, and found that:
scala (1.to(10)).foreach { println }

results in the same output. Cool!

Say Thanks
Respond