//= Floor division assignment
Last updated: 2026-09-22
//= Floor division assignment
//= floor-divides the left variable by the right value (rounding down), equivalent to x = x // y.
| Category | Operators |
|---|---|
| Kind | Operator |
📝 Syntax
x //= y
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
3
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat is the difference between x //= 2 and x /= 2?
A`//=` is floor division: with `x = 7; x //= 2`, `x == 3` and keeps the int type; `/= ` always yields a float.
QWhat happens with //= on negative numbers?
AIt still floors toward negative infinity: with `x = -7; x //= 2`, `x == -4` (not `-3`).
QMust x in x //= 2 be an integer?
ANo. Floats work too: with `x = 7.5; x //= 2`, `x == 3.0`, and the result is still a float.