Can anyone explain why both functions get called in Ternary expression here:
func ifelse(_ condition: Bool, _ valueTrue: Any, _ valueFalse: Any) -> Any {
condition ? valueTrue : valueFalse
}
func expensiveValue1() -> Int {
print("side-effect-1")
return 2
}
func expensiveValue2() -> Int {
print("side-effect-2")
return 1729
}
let taxicab = ifelse(.random(), expensiveValue1(), expensiveValue2())