Last active
May 4, 2018 20:07
-
-
Save mcmillhj/494e245bfb3caa3c06099f083174852b to your computer and use it in GitHub Desktop.
Missing Block error on line 20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl6 | |
class Stack { | |
has Int @!store; | |
method push(Int:D $elem --> Nil) { | |
push @!store, $elem; | |
} | |
method pop(--> Int) { | |
die "UNDERFLOW" if self.is-empty(); | |
pop @!store; | |
} | |
method peek(--> Int) { | |
@!store[* - 1]; | |
} | |
method is-empty(-> Bool) { # Missing block | |
@!store.elems == 0; | |
} | |
} | |
my $s = Stack.new(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment