Last active
May 1, 2020 18:21
-
-
Save podhmo/33ae2bc632815360d6e47020f3ffeb39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Op uint8 | |
const ( | |
OpAdd Op = iota + 1 | |
OpSub | |
OpMul | |
) | |
var ( | |
_ops = [...]string{"", "Add", "Sub", "Mul"} | |
) | |
func (v Op) String() string { | |
return _ops[v] | |
} | |
func main() { | |
fmt.Println(OpAdd) | |
fmt.Println(OpAdd == OpAdd, OpAdd == OpMul) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment