Stair-climbing puzzle: Difference between revisions

Forth
m (whitespace)
(Forth)
Line 200:
return loop(1)
}</lang>
 
=={{header|Forth}}==
Recursive. May exceed return stack unless compiler optimizes tail calls.
: step-up begin step 0= while recurse repeat ;
Counting. Avoids using a named variable.
: step-up -1 begin step if 1+ else 1- then ?dup 0= until ;
 
=={{header|Fortran}}==
Anonymous user