Queue/Usage: Difference between revisions

Content added Content deleted
m (→‎version 1: removed superflous blanks. -- ~~~~)
Line 1,321: Line 1,321:


=={{header|REXX}}==
=={{header|REXX}}==
===version 1===
The REXX language was developed under IBM VM/CMS operating system, and CMS had a stack mechanism built-into the
The REXX language was developed under IBM VM/CMS operating system, and CMS had a stack mechanism built-into the
<br>operating system, so REXX utilized that resource.
<br>operating system, so REXX utilized that resource.
Line 1,331: Line 1,330:
<br>The entries in the stack may be anything, including "nulls".
<br>The entries in the stack may be anything, including "nulls".
<lang rexx>/*REXX program demonstrates three queue operations: push, pop, queued. */
<lang rexx>/*REXX program demonstrates three queue operations: push, pop, queued. */

say '══════════════════════════════════Pushing five values to the stack.'
say '══════════════════════════════════Pushing five values to the stack.'
do j=1 for 4 /*loop to PUSH four values. */
do j=1 for 4 /*loop to PUSH four values. */
Line 1,347: Line 1,345:
say '══════════════════════════════════The stack is now empty.'
say '══════════════════════════════════The stack is now empty.'
exit
exit

/*─────────────────────────────────────subroutines/functions/operators. */
/*─────────────────────────────────────subroutines/functions/operators. */
push: queue arg(1); return /*REXX QUEUE is FIFO. */
push: queue arg(1); return /*REXX QUEUE is FIFO. */
pop: procedure; pull x; return x /*REXX PULL removes a stack item*/
pop: procedure; pull x; return x /*REXX PULL removes a stack item*/
empty: return queued()==0 /*returns the status of the stack*/</lang>
empty: return queued()==0 /*returns the status of the stack*/</lang>
'''output'''
Output:
<pre style="height:40ex;overflow:scroll">
<pre style="overflow:scroll">
══════════════════════════════════Pushing five values to the stack.
══════════════════════════════════Pushing five values to the stack.
pushed value: 10
pushed value: 10