Anonymous user
Handle a signal: Difference between revisions
m
→{{header|REXX}}: changed/added comments and whitespace, changed indentations, add comments in the REXX section header and output section.
(Added COBOL) |
m (→{{header|REXX}}: changed/added comments and whitespace, changed indentations, add comments in the REXX section header and output section.) |
||
Line 1,105:
=={{header|REXX}}==
REXX has no
<br>Some operating systems that REXX runs under have a '''SLEEP''' or equivalent function.▼
<br><br>But, there's more than one way to skin a cat. (No offense to cat lovers.)▼
<lang rexx>/*REXX program displays integers until a Ctrl─C is pressed, then show*/▼
▲
call time 'E' /*reset the REXX elapsed timer. */▼
do j=1 /*start with 1 and go ye forth. */▼
▲<lang rexx>/*REXX program displays integers until a Ctrl─C is pressed, then
say right(j,20) /*display integer right-justified*/▼
/*────────────────────────────────── seconds that have elapsed since start of execution.*/
call time 'Reset'
signal on halt
u>t+.5 then iterate j /* ◄═══ means we passed ½ second.*/▼
end /*forever*/▼
end /*j*/▼
▲ say right(j,20) /*display the integer right-justified. */
do forever; u=time('Elapsed') /* " " " " " " " */
▲ end /*forever*/
/*stick a fork in it, we're all done. */</lang>▼
▲halt: say 'program HALTed, it ran for' format(time("E"),,2) 'seconds.'
'''output'''
▲ /*stick a fork in it, we're done.*/</lang>
<pre>
1
Line 1,156 ⟶ 1,153:
</pre>
Note: some REXX interpreters don't show the
<b>
<pre>
^C
</pre>
</b>
when <big> Ctrl-C </big> is pressed.
<br><br>
=={{header|Ruby}}==
|