Anonymous user
Execute HQ9+: Difference between revisions
→{{header|REXX}}: added comments and seperator lines to program. -- ~~~~
(→{{header|REXX}}: added comments and seperator lines to program. -- ~~~~) |
|||
Line 716:
=={{header|REXX}}==
<lang rexx>/*REXX program to implement the HQ9+ language.*/ parse arg pgm .▼
▲/*the HQ9+ language.*/ parse arg pgm .
do instructions=1 for length(pgm)
Line 732 ⟶ 731:
end /*instructions*/
exit
/*─────────────────────────────────────99 subroutine────────────────────*/
99: do j=99 by -1 to 1
say j 'bottle's(j) "of beer the wall,"
Line 747 ⟶ 746:
say '99 bottles of beer on the wall.'
return
/*─────────────────────────────────────S subroutine─────────────────────*/
s: if arg(1)=1 then return ''; return 's'
▲Output when using the input of:
<pre style="height:40ex;overflow:scroll">
hello, world
/*REXX program to implement the HQ9+ language.*/ parse arg pgm .
do instructions=1 for length(pgm)
Line 770 ⟶ 766:
end /*instructions*/
exit
/*─────────────────────────────────────99 subroutine────────────────────*/
99: do j=99 by -1 to 1
say j 'bottle's(j) "of beer the wall,"
Line 785 ⟶ 781:
say '99 bottles of beer on the wall.'
return
/*─────────────────────────────────────S subroutine─────────────────────*/
s: if arg(1)=1 then return ''; return 's'
</pre>
|