Last active
May 4, 2018 20:07
Star
You must be signed in to star a gist
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