Jump to content

Nested function: Difference between revisions

m
→‎{{header|REXX}}: user the function name suggest by the task.
m (→‎{{header|REXX}}: simplified the code.)
m (→‎{{header|REXX}}: user the function name suggest by the task.)
Line 1,150:
<lang rexx>/*REXX program demonstrates that functions can be nested (an outer and inner function).*/
ctr= 0 /*initialize the CTR REXX variable.*/
call makeListMakeList . /*invoke makeListMakeList with the separator.*/
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
makeItem: parse arg sep,text; ctr= ctr + 1 /*bump the counter variable. */
say ctr || sep word(string$, ctr) /*display three thingys to the───► terminal. */
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
makeListMakeList: parse arg sep; string$= 'first second third' /*getobtain argumentsan argument; define a strongstring.*/
do while ctr<3 /*keep truckin' until finished. */
call makeItem sep, string$ /*invoke the makeItem function. */
end /*while*/
return</lang>
{{out|output|text=&nbsp; when using the default input:}}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.