10 lines
253 B
Text
10 lines
253 B
Text
class Stack(stack=[]) {
|
|
method pop { stack.pop };
|
|
method push(item) { stack.push(item) };
|
|
method empty { stack.is_empty };
|
|
}
|
|
|
|
var stack = Stack();
|
|
stack.push(42);
|
|
say stack.pop; # => 42
|
|
say stack.empty; # => true
|