Anonymous recursion: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added comments, added subroutine fence, added DO-END comment label, changed comments, added whitespace. -- ~~~~) |
|||
Line 1,129: | Line 1,129: | ||
to be OK with implementors, here is the REXX version: |
to be OK with implementors, here is the REXX version: |
||
<lang rexx>/*REXX program to show anonymous recursion (of a function/subroutine). */ |
<lang rexx>/*REXX program to show anonymous recursion (of a function/subroutine). */ |
||
numeric digits 1e6 /*in case the user goes kaa-razy.*/ |
numeric digits 1e6 /*in case the user goes kaa-razy.*/ |
||
do j=0 to word(arg(1) 12,1) |
do j=0 to word(arg(1) 12, 1) /*use argument or the default: 12*/ |
||
say 'fibonacci('j") =" fib(j) /*show Fibonacci sequence: |
say 'fibonacci('j") =" fib(j) /*show Fibonacci sequence: 0──►x */ |
||
end |
end /*j*/ |
||
exit /*stick a fork in it, we're done.*/ |
|||
exit |
|||
/*──────────────────────────────────subroutines─────────────────────────*/ |
|||
⚫ | |||
/*-----------------------------------FIB subroutine---------------------*/ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
'''output''' when using the default input (<tt> 12 </tt>): |
'''output''' when using the default input (<tt> 12 </tt>): |
||
<pre style="overflow:scroll"> |
<pre style="overflow:scroll"> |