如果別的

Dart 還有其他:

if (year >= 2001) {
  print('21st century');
} else if (year >= 1901) {
  print('20th century');
} else {
  print('We Must Go Back!');  
}

Dart 還有一個三元 if 運算子:

var foo = true;
print(foo ? 'Foo' : 'Bar'); // Displays "Foo".