Home Segments Top Top Previous Next

398: Mainline

The value of the following expression is the string, "minute", if the length change is 1 minute; otherwise, the value is the string, "minutes":

 Conditional   If-true     If-false 
 expression   expression  expression 
     |           |           | 
     v           v           v 
-----------   --------   --------- 
change == 1 ? "minute" : "minutes" 

You can, if you wish, employ parentheses to delineate the Boolean expression, but parentheses are not needed in the example, because the equality operator has precedence higher than that of the conditional operator.