Solution Review: Make a Stack with Variable Internal Types

This lesson discusses the solution to the challenge given in the previous lesson.

package main
import (
	"fmt"
	"mystack"
)

var st1 mystack.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)
	}
}

Get hands-on with 1400+ tech skills courses.