Loops/Downward for: Difference between revisions
Content added Content deleted
m (→{{header|8080 Assembly}}: fixed syntax highlight) |
(added ALGOL-M example) |
||
Line 342: | Line 342: | ||
print((i,new line)) |
print((i,new line)) |
||
OD</syntaxhighlight> |
OD</syntaxhighlight> |
||
=={{header|ALGOL-M}}== |
|||
Sadly, ALGOL-M's FOR statement does not allow a negative value |
|||
for STEP, so we have to use a WHILE loop if we wish to count down. |
|||
<syntax highlight lang="ALGOL"> |
|||
begin |
|||
integer i; |
|||
i := 10; |
|||
while (i > 0) do |
|||
begin |
|||
writeon(i); |
|||
i := i - 1; |
|||
end; |
|||
end |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
10 9 8 7 6 5 4 3 2 1 |
|||
</pre> |
|||
=={{header|ALGOL W}}== |
=={{header|ALGOL W}}== |