Control flow

Order of operation

If

const trafficLight = 'yellow';
var command = '';
if (trafficLight == 'red') {
  command = 'Stop';
} else if (trafficLight == 'yellow') {
  command = 'Slow down';
} else if (trafficLight == 'green') {
  command = 'Go';
} else {
  command = 'INVALID COLOR!';
}
print(command);

Ternary Operator

(condition) ? valueIfTrue : valueIfFalse;

Switch

switch (variable) {
  case value1:
    // code
    break;
  case value2:
    // code
    break;

    ...

  default:
    // code
}

Null operators