Files
the-way-to-go_ZH_CN/eBook/exercises/chapter_11/main_stack.go
2015-03-03 12:25:25 -05:00

29 lines
381 B
Go
Executable File

// main_stack.go
package main
import (
"fmt"
"./stack/stack"
)
var st1 stack.Stack
func main() {
st1.Push("Brown")
st1.Push(3.14)
st1.Push(100)
st1.Push([]string{"Java", "C++", "Python", "C#", "Ruby"})
for {
item, err := st1.Pop()
if err != nil {
break
}
fmt.Println(item)
}
}
/* Output:
[Java C++ Python C# Ruby]
100
3.14
Brown
*/