Basics
Arithmetic
~/, %, /
/ always returns a double. Use ~/ for integer division. % is the remainder.
Program
Play the program to compute integer division, remainder, and a real ratio.
arithmetic.dart
void main() {
var a = 7;
var b = 2;
var quotient = a ~/ b;
var remainder = a % b;
var ratio = a / b;
print('$quotient $remainder $ratio');
}
~/
`~/` is truncating integer division.
%
`%` returns the remainder.
/
`/` always returns a `double`, even for whole results.