Thuta Learning
BasicProgrammingbeginner

Operators

Relax. We'll talk through this in plain words — no textbook voice.

Operators are the symbols you use for calculations, comparisons, and logical decisions. Most app logic comes down to operators deciding "what should happen next."

dart
void main() {
  int price = 12000;
  int discount = 2000;
  int finalPrice = price - discount;

  bool hasEnoughMoney = finalPrice <= 10000;
  bool isMember = true;

  print('Final price: $finalPrice');

  if (hasEnoughMoney && isMember) {
    print('You can buy this item with member benefit.');
  }

  print(7 % 2); // Remainder
}

- subtracts the discount, <= checks the condition, and && only returns true when both conditions are true. % gives you the remainder, which is commonly used to check for even/odd.

You should see
Final price: 10000 You can buy this item with member benefit. 1

Easy traps

  • = assigns a value, while == checks for equality. Mixing up the two can lead to logic bugs.