Wiki

Changes between Version 2 and Version 3 of IfExpression

Show
Ignore:
Timestamp:
05/31/13 13:42:01 (12 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IfExpression

    v2 v3  
    55=== Grammar === 
    66{{{ 
    7 if(<condition>, <texpr>, <fexpr>) 
     7if( <condition>, <texpr>, <fexpr>) 
    88}}} 
    99 
    1010If 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. 
    1111 
     12Note that there can be no space between the 'if' and the '(' - there is a single token 'if('. 
     13 
    1214The type of the '''if''' expression is the greatest common denominator between the type of '''texpr''' and the type of '''fexpr'''. 
    1315 
    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. 
     16Note 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 
    1518 
    1619{{{