the expression is parsed into an AST, that is walked during evaluation. The if() is parsed as a special function : its condition is evaluated first, then only the relevant part is evaluated for return