Closed arnold-parge closed 3 months ago
In the enum example, the description says:
If we have a value of type int, we cannot pass it to transition - the compiler will complain about type mismatch. This provides some degree of compile-time type safety for enums.
If we pass an int to the transition it will allow and not complain.
transition
eg:
func main() { ns := transition(0) fmt.Println(ns) ns2 := transition(ns) fmt.Println(ns2) }
Output:
connected idle
Oh, you meant we can't do this
func main() { n := 0 ns := transition(n) fmt.Println(ns) ns2 := transition(ns) fmt.Println(ns2) }
👍
In the enum example, the description says:
If we pass an int to the
transition
it will allow and not complain.eg:
Output: