Changes between Version 2 and Version 3 of IfExpression
- Timestamp:
- 05/31/13 13:42:01 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IfExpression
v2 v3 5 5 === Grammar === 6 6 {{{ 7 if( <condition>, <texpr>, <fexpr>)7 if( <condition>, <texpr>, <fexpr>) 8 8 }}} 9 9 10 10 If the '''condition''' is true, '''texpr''' is evaluated; otherwise '''fexpr''' is evaluated. The condition is always evaluated and subsequently '''texpr''' or '''fexpr''' will be unless condition threw an exception. 11 11 12 Note that there can be no space between the 'if' and the '(' - there is a single token 'if('. 13 12 14 The type of the '''if''' expression is the greatest common denominator between the type of '''texpr''' and the type of '''fexpr'''. 13 15 14 Note that using '''if''' expressions to check for '''nil''' is uncommon, since there is a coalesce operator for that purpose which is more succinct and avoids double evaluation. 16 Note also that using '''if''' expressions to check for '''nil''' is uncommon, since there is a coalesce operator for that purpose which is more succinct and avoids double evaluation. 17 15 18 16 19 {{{