1. Miki Tebeka
  2. go-play

Commits

Miki Tebeka  committed 313f2e1

Print right

  • Participants
  • Parent commits f7a3172
  • Branches default

Comments (0)

Files changed (1)

File stack.go

View file
  • Ignore whitespace
 }
 
 func (stack *Stack) String() string {
-	return fmt.Sprintf("%v", stack.items)
+	return fmt.Sprintf("%v", stack.items[:stack.count])
 }
 
 func main() {
 	s.Push(2)
 	fmt.Println(s)
 	i, ok := s.Pop()
+	fmt.Println(s)
 	fmt.Println(i, ok)
 	i, ok = s.Pop()
+	fmt.Println(s)
 	fmt.Println(i, ok)
 	i, ok = s.Pop()
+	fmt.Println(s)
 	fmt.Println(i, ok)
 }