Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 609 Bytes

File metadata and controls

30 lines (23 loc) · 609 Bytes

Division

You can divide any two ints using the / operator.

~void main() {
int x = 8;
// y will be 4
int y = x / 2;

IO.println(x);
IO.println(y);
~}

Division with integers gives results in only the quotient of the result, not the remainder.

So 5 / 2 does not result in 2.5, but instead just 2.

~void main() {
// 5 / 2 is not 2.5, but instead 2.
int x = 5 / 2;
// 13 / 3 is not 4.3333, but instead 4.
int y = 13 / 3;

IO.println(x);
IO.println(y);
~}