Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Smalltalk

Idiom #256 Count backwards

Print the numbers 5, 4, ..., 0 (included), one line per number.

5 to: 0 by: -1 do: [:i | Transcript showln: i asString].
for A in reverse 0 .. 5 loop
   Put_Line (A'Image);
end loop;

New implementation...
< >
programming-idioms.org