Jump to content

Queue/Definition: Difference between revisions

Applesoft BASIC
m (→‎{{header|Phix}}: syntax coloured, added builtin comment)
(Applesoft BASIC)
Line 843:
Put_Line(Integer'Image(Val));
end select;
end loop;<lang ada>
end Reader;
begin
Line 988:
barney
</pre>
 
=={{header|Applesoft BASIC}}==
<lang ApplesoftBasic> 0 DEF FN E(MPTY) = SP = 0
10 GOSUB 150EMPTY
20 LET A$ = "A": GOSUB 100PUSH
30 LET A$ = "B": GOSUB 100PUSH
40 GOSUB 150EMPTY
50 GOSUB 120 POP
60 GOSUB 120 POP
70 GOSUB 150EMPTY
80 GOSUB 120 POP
90 END
100 PRINT "PUSH "A$
110 LET S$(SP) = A$:SP = SP + 1: RETURN
120 GOSUB 130: PRINT "POP "A$: RETURN
130 IF FN E(0) THEN PRINT "POPPING FROM EMPTY QUEUE";: STOP
140 LET SP = SP - 1:A$ = S$(SP): RETURN
150 PRINT "EMPTY? " MID$ ("YESNO",4 ^ FN E(0),3): RETURN</lang>
 
=={{header|ARM Assembly}}==
413

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.