Annotation of loncom/html/adm/help/tex/Spreadsheet_Ternary_Operator.tex, revision 1.1

1.1     ! bowersj2    1: The ?'s and :'s seen in the spreadsheet cells are part of compact notation for an if-then-else clause. Something like:
        !             2: 
        !             3: \texttt{( B2 > 16 ? 'passing grade' : 'failing grade')}
        !             4: 
        !             5: can be translated into:
        !             6: 
        !             7: \texttt{if (B2 > 16 ) \{ \\
        !             8:   \hspace*{16pt}     \$temp = 'passing grade';\\
        !             9:   \} else \{ \\
        !            10:   \hspace*{16pt}     \$temp = 'failing grade'; \\
        !            11:   \} \\
        !            12:   \$temp;\\
        !            13: }
        !            14: 
        !            15: The nicest part of the ( ? : ) operator (aside from its compactness)
        !            16: is the way it automatically returns the value you want without having
        !            17: to use any temporary variable.s

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>