Created
December 31, 2017 23:58
-
-
Save stoeckley/f6da4a656b911d247e827ef2a15badc4 to your computer and use it in GitHub Desktop.
how to initialize a let based on conditional branches
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
// i often do this just so i can make a variable a constant let and not a var; | |
// with a var I could just use a switch, but it's better to have a let when possible | |
// how to make this prettier? | |
let someConstant: Int64 = | |
someBoolExpression ? 1 : | |
someOtherBoolExpression ? 2 : | |
yetAnotherBoolExpression ? 3 : 0 | |
// or perhaps this style of code is just acceptable? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and