Created
August 28, 2017 05:05
-
-
Save akm/052397137d0b9ce9b235988e11023796 to your computer and use it in GitHub Desktop.
Goでの三項演算子っぽい書き方 ref: http://qiita.com/akm/items/1842f7c5b9755829886a
This file contains hidden or 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" | |
func main() { | |
foo := map[bool]string{true: "OK", false: "NG"}[2 > 1] | |
fmt.Printf("foo: %v\n", foo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment