← Dart tutorial

Dart

Operators

Arithmetic (+ - * /), comparison (== != > <), and logical (&& || !) operators all work as you'd expect from other C-family languages.

Example: a boolean expression, printed with interpolation

void main() {
  int score = 85;
  bool passed = score >= 50 && score <= 100;
  print('Passed: $passed');
}
Passed: true

$passed inside a single-quoted string interpolates the variable directly — Dart's string interpolation works in both single and double-quoted strings, unlike some languages (PHP, for instance, only interpolates inside double quotes).

Example
void main() {
  int score = 85;
  bool passed = score >= 50 && score <= 100;
  print('Passed: $passed');
}
Output
Passed: true