Replicated values and expressions
When a replicated value appears within an expression, the entire expression becomes replicated.
double celsius celsius = 22 celsius * 1.8 + 32 // Result is 71.6. celsius = {-9, 0, 9} celsius * 1.8 + 32 // Result is {15.8, 32, 48.2}. celsius <= 7 // Result is {true, true, false}. celsius <= 7 ? 'coat' : 'jacket' // Result is {'coat', 'coat', 'jacket'}.
Examples
celsius = 0 if (celsius < 7) Print('Cold!'); // This works (and prints "Cold!"). celsius = {-9, 0, 9} if (celsius < 7) Print('Cold!'); // This does NOT work!
The last statement produces the error message, "Within a 'do', 'for', 'if' or 'while' statement, the control expression must resolve to a single bool value." (Those statement types are covered in the next section, Statements.)