Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 387 Bytes

File metadata and controls

30 lines (24 loc) · 387 Bytes

Subtraction

You can subtract any two ints using the - operator.

~void main() {
int x = 5;
// y will be 4
int y = x - 1;
// z will be 1
int z = x - y;

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

Subtracting a negative number does the same thing as addition.

~void main() {
int x = 5;
// y will be 9
int y = x - -4;

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