Beispiel #1
0
func ExampleLoop() {
	q := queue.EmptyQueue()
	for i := 1; i < 6; i++ {
		q.Push(i)
	}
	sum := 0
	for !q.Empty() {
		var val int = q.Pop().(int)
		sum += val
	}
	fmt.Println(sum)
	// Output: 15
}
Beispiel #2
0
func Example() {
	q := queue.EmptyQueue()
	q.Push(0)
	q.Push(1)
	q.Push(2)

	first := q.Pop()
	second := q.Pop()
	third := q.Pop()

	fmt.Println(first, second, third)
	// Output: 0 1 2
}