What is the result of 10 ~/ 3 in Dart?
~/ is integer division. It divides and truncates the decimal. 10 / 3 = 3.33, but 10 ~/ 3 = 3.
Master arithmetic, comparison, logical and null-aware operators
Passing the Quiz & Exercises is mandatory to earn FX and proceed. If you fail, try again to gain the required FX, then the Proceed button will become available.
You can read this lesson publicly. Sign in to unlock exercises, quiz, and FX progress tracking.
Having trouble? AI is here to help
Ask context-aware questions about this lesson. Free plan: 5 questions/day. Upgrade to Premium for higher daily limits.
Use the AI button at the bottom of the screen
Operators perform actions on values. You will use them constantly in every Flutter application.
1// ── Arithmetic ──2int a = 10, b = 3;3print(a + b); // 13 - addition4print(a - b); // 7 - subtraction5print(a * b); // 30 - multiplication6print(a / b); // 3.33 - division (returns double)7print(a ~/ b); // 3 - integer division (truncates)8print(a % b); // 1 - modulus (remainder)910// ── Comparison ──11print(a == b); // false12print(a != b); // true13print(a > b); // true14print(a <= 10); // true1516// ── Logical ──17bool x = true, y = false;18print(x && y); // false - AND (both must be true)19print(x || y); // true - OR (one must be true)20print(!x); // false - NOT
1// ── Assignment Shortcuts ──2int n = 10;3n += 5; // n = 154n -= 3; // n = 125n *= 2; // n = 246n ~/= 4; // n = 678// ── Ternary Operator (inline if/else) ──9int score = 75;10String grade = score >= 60 ? 'Pass' : 'Fail'; // 'Pass'1112// ── Cascade (..) - chain multiple calls on same object ──13final buffer = StringBuffer()14..write('Hello')15..write(' Flutter');16print(buffer.toString()); // Hello Flutter1718// ── Type Test ──19dynamic val = 42;20print(val is int); // true21print(val is! String); // true22print(val as int); // 42 (type cast)
The ternary operator is everywhere in Flutter for conditional widgets: ```dart child: isLoading ? const CircularProgressIndicator() : Text(data), ```
Common mistakes in real projects:
Readable operator usage is a maintainability decision, not just a syntax detail.
Master arithmetic, comparison, logical and null aware operators. Dart is the language behind Flutter, and clear Dart code makes your Flutter UI easier to maintain.
Build confidence with basics first; speed comes later.
Prefer readable names, explicit intent, and async/await over deeply nested callbacks.
When Dart basics are weak, state bugs, null crashes, and async confusion increase quickly.
~/ is integer division. It divides and truncates the decimal. 10 / 3 = 3.33, but 10 ~/ 3 = 3.
The ternary condition (45 >= 60) is false, so the expression returns the else branch: "Fail".
&& (AND) returns true only if BOTH operands are true. || (OR) returns true if at least ONE is true.
Cascade (..) lets you chain multiple operations on the same object without repeating a variable name.
Something seems incorrect, unclear, or missing? Let us know.
FlutterCraft editorial lessons are reviewed by experienced Flutter developers and updated to stay aligned with modern Flutter and Dart best practices.
Reference docs: Flutter Documentation, Dart Language Tour, and official package documentation where relevant.
Sign in to continue with exercises and quiz for this lesson.
Sign In to Continue