Loops/Wrong ranges: Difference between revisions

Added 11l
(add fermat)
(Added 11l)
Line 47:
*   [[Loops/Wrong ranges]]
<br><br>
 
=={{header|11l}}==
{{trans|Nim}}
 
<lang 11l>F displayRange(first, last, step)
print(‘(#2, #2, #2): ’.format(first, last, step), end' ‘’)
I step == 0
print(‘not allowed.’)
E
print(Array((first..last).step(step)))
 
L(f, l, s) [(-2, 2, 1), (-2, 2, 0), (-2, 2, -1),
(-2, 2, 10), (2, -2, 1), ( 2, 2, 1),
( 2, 2, -1), (2, 2, 0), ( 0, 0, 0)]
displayRange(f, l, s)</lang>
 
{{out}}
<pre>
(-2, 2, 1): [-2, -1, 0, 1, 2]
(-2, 2, 0): not allowed.
(-2, 2, -1): []
(-2, 2, 10): [-2]
( 2, -2, 1): []
( 2, 2, 1): [2]
( 2, 2, -1): [2]
( 2, 2, 0): not allowed.
( 0, 0, 0): not allowed.
</pre>
 
=={{header|Ada}}==
1,480

edits