Remove the top element from the stack and return it's value If the stack is empty, return nil
()
| 24 | // Remove the top element from the stack and return it's value |
| 25 | // If the stack is empty, return nil |
| 26 | func (s *Stack) Pop() (value int) { |
| 27 | if s.size > 0 { |
| 28 | value, s.top = s.top.value, s.top.next |
| 29 | s.size-- |
| 30 | return value |
| 31 | } |
| 32 | return -1 |
| 33 | } |