Chapter 1 - Why both functions called in Ternary expression?

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())

I figured out it, when passing them to ifelse function, they get called.

Right! And this is where @autoclosure comes to the rescue. :smiley: