Jump to content

Loops/For with a specified step: Difference between revisions

no edit summary
(Added Nemerle)
No edit summary
Line 612:
 
(Print all odd numbers from 1 to 50)
 
=={{header|Scala}}==
<lang scala>
for (i <- 2 to 8 by 2) {
println(i)
} </lang>
 
Alternately:
<lang scala>
(2 to 8 by 2) foreach println</lang>
 
=={{header|Scheme}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.