Created
September 22, 2018 01:05
-
-
Save Insulince/95556a3c5b925fcf242933420d5398cf to your computer and use it in GitHub Desktop.
An example of nesting the Golang version of a JavaScript ternary operation into itself an arbitrary amount of times. Again, and I cannot stress this enough, DO NOT DO THIS.
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" | |
) | |
func main() () { | |
for num := 0; num < 16; num++ { | |
fmt.Println(num, map[bool]string{ | |
true: map[bool]string{ | |
true: map[bool]string{ | |
true: map[bool]string{ | |
true: "a", | |
false: "b", | |
}[num == 0], | |
false: map[bool]string{ | |
true: "c", | |
false: "d", | |
}[num == 2], | |
}[num < 2], | |
false: map[bool]string{ | |
true: map[bool]string{ | |
true: "e", | |
false: "f", | |
}[num == 4], | |
false: map[bool]string{ | |
true: "g", | |
false: "h", | |
}[num == 6], | |
}[num < 6], | |
}[num < 4], | |
false: map[bool]string{ | |
true: map[bool]string{ | |
true: map[bool]string{ | |
true: "i", | |
false: "j", | |
}[num == 8], | |
false: map[bool]string{ | |
true: "k", | |
false: "l", | |
}[num == 10], | |
}[num < 10], | |
false: map[bool]string{ | |
true: map[bool]string{ | |
true: "m", | |
false: "n", | |
}[num == 12], | |
false: map[bool]string{ | |
true: "o", | |
false: "p", | |
}[num == 14], | |
}[num < 14], | |
}[num < 12], | |
}[num < 8]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment