Skip to content

Instantly share code, notes, and snippets.

@mcmillhj
Last active May 4, 2018 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcmillhj/494e245bfb3caa3c06099f083174852b to your computer and use it in GitHub Desktop.
Save mcmillhj/494e245bfb3caa3c06099f083174852b to your computer and use it in GitHub Desktop.
Missing Block error on line 20
#!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