package main
import "fmt"
// Test and print emptiness result.
func empty_test(is *IntStack) {
if is.empty() {
fmt.Println("Empty")
} else {
fmt.Println("Not Empty")
}
}
func main() {
var s IntStack
empty_test(&s)
// Put some stuff.
for i := 1; i < 10; i++ {
s.push(i)
}
empty_test(&s)
// Lose some.
for i := 1; i < 5; i++ {
pv, _ := s.pop()
fmt.Printf("%d ", pv)
}
fmt.Println()
empty_test(&s)
// Put some other stuff on
for i := 25; i < 35; i++ {
s.push(i)
}
empty_test(&s)
// Dump it all
for {
i, ok := s.pop()
if ok {
fmt.Printf("%d ", i)
} else {
break
}
}
fmt.Println()
empty_test(&s)
}