Queue/Definition: Difference between revisions

Content added Content deleted
No edit summary
Line 4,508:
 
=={{header|SenseTalk}}==
A queue in SenseTalk is implemented using push and pull operations on a list.
<lang sensetalk>
set myFoods to be an empty list
 
push "grapes" into myFoods
push "orange" into myFoods
push "apricot" into myFoods
 
put "The foods in my queue are: " & myFoods
 
pull from myFoods into firstThingToEat
 
put "The first thing to eat is: " & firstThingToEat
 
if myFoods is empty then
put "The foods list is empty!"
else
put "The remaining foods are: " & myFoods
end if
</lang>
Output:
<lang sensetalk>
The foods in my queue are: (grapes,orange,apricot)
The first thing to eat is: grapes
The remaining foods are: (orange,apricot)
</lang>