Expressions
Examples:
sum += x; // same as sum = sum + x
r -= n; q++;
s = "temp" + 1; // assign "temp1" to s
phi = (1 + Math.sqrt(5))/2;
valid = (age > 21 && age <= 65);
An if-expression returns a value:
p = ( k < 0 ) ? 1/y : y;
Previous slide
Next slide
Back to first slide
View graphic version