RosettaCodeData/Task/Queue-Definition/Elisa/queue-definition-2.elisa
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

29 lines
506 B
Text

use GenericQueue (QueueofPersons, Person);
type Person = text;
Q = QueueofPersons(25);
Push (Q, "Peter");
Push (Q, "Alice");
Push (Q, "Edward");
Q?
QueueofPersons:[MaxLength = 25;
length = 3;
list = { "Peter",
"Alice",
"Edward"}]
Pull (Q)?
"Peter"
Pull (Q)?
"Alice"
Pull (Q)?
"Edward"
Q?
QueueofPersons:[MaxLength = 25;
length = 0;
list = { }]
Pull (Q)?
***** Exception: Queue Underflow