Jump to content

Queue/Usage: Difference between revisions

25 bytes removed ,  12 years ago
m
→‎version 1: removed superflous blanks. -- ~~~~
m (→‎version 1: removed superflous blanks. -- ~~~~)
Line 1,321:
 
=={{header|REXX}}==
===version 1===
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.
Line 1,331 ⟶ 1,330:
<br>The entries in the stack may be anything, including "nulls".
<lang rexx>/*REXX program demonstrates three queue operations: push, pop, queued. */
 
say '══════════════════════════════════Pushing five values to the stack.'
do j=1 for 4 /*loop to PUSH four values. */
Line 1,347 ⟶ 1,345:
say '══════════════════════════════════The stack is now empty.'
exit
 
/*─────────────────────────────────────subroutines/functions/operators. */
push: queue arg(1); return /*REXX QUEUE is FIFO. */
pop: procedure; pull x; return x /*REXX PULL removes a stack item*/
empty: return queued()==0 /*returns the status of the stack*/</lang>
'''output'''
Output:
<pre style="height:40ex;overflow:scroll">
══════════════════════════════════Pushing five values to the stack.
pushed value: 10
Cookies help us deliver our services. By using our services, you agree to our use of cookies.