2023-07-01 11:58:00 -04:00
|
|
|
stack = .queue~of(123, 234) -- creates a stack with a couple of items
|
|
|
|
|
stack~push("Abc") -- pushing
|
|
|
|
|
value = stack~pull -- popping
|
2025-08-11 18:05:26 -07:00
|
|
|
say 'popped:' value
|
2023-07-01 11:58:00 -04:00
|
|
|
value = stack~peek -- peeking
|
2025-08-11 18:05:26 -07:00
|
|
|
say 'peeked:' value
|
2023-07-01 11:58:00 -04:00
|
|
|
-- the is empty test
|
|
|
|
|
if stack~isEmpty then say "The stack is empty"
|
2025-08-11 18:05:26 -07:00
|
|
|
Else say stack~items 'items are on the stack'
|