Anonymous user
Events: Difference between revisions
m
→{{header|REXX}}: added/changed whitespace and comments, aligned statements, used a template for the output section.
m (→{{header|REXX}}: added/changed whitespace and comments, aligned statements, used a template for the output section.) |
|||
Line 1,109:
<br>Here is a ''time-driven'' example of events happening, based on specific timer ticks.
<lang rexx>/*REXX program demonstrates a method of handling events (this is a time─driven pgm).*/
signal on halt /*allow
parse arg timeEvent /*allow the "event" to be specified. */
if timeEvent='' then timeEvent=
event?: do forever /*determine if an event has occurred. */
theEvent= right(time(), 1)
if pos(theEvent, timeEvent)
end /*forever*/
say 'Control should never get here!' /*This is a logic can─never─happen ! */
halt: say '════════════ program halted.';
/*──────────────────────────────────────────────────────────────────────────────────────*/
happening: say 'an event occurred at' time()", the event is:" theEvent
do
nop /*replace NOP with the "process" code.*/
end /*while*/ /*NOP
<pre>
an event occurred at 16:13:29, the event is: 9
|