Loops/For with a specified step: Difference between revisions
Content added Content deleted
(adding maxima) |
|||
Line 679: | Line 679: | ||
<lang ruby>(2..8).step(2) {|n| print "#{n}, "} |
<lang ruby>(2..8).step(2) {|n| print "#{n}, "} |
||
puts "who do we appreciate?"</lang> |
puts "who do we appreciate?"</lang> |
||
Output |
|||
<pre>2, 4, 6, 8, who do we appreciate?</pre> |
|||
=={{header|Run BASIC}}== |
|||
<lang runbasic>for i = 2 to 8 step 2 |
|||
print i; ", "; |
|||
next i |
|||
print "who do we appreciate?"</lang> |
|||
Output |
Output |
||
<pre>2, 4, 6, 8, who do we appreciate?</pre> |
<pre>2, 4, 6, 8, who do we appreciate?</pre> |