import ballerina/io;

public function main() {
    int m = 1;

    // Integer literals can be hexadecimal (but not octal).
    int n = 0xFFFF;

    // You can use compound assignment operations such as `+=` and `-=`. 
    n += m;

    io:println(n);
}

Integers

The int type is 64-bit signed integers (same as long in Java) and supports the usual arithmetic operators: + - / %. The operator precedence is same as C. Integer overflow is a runtime error in Ballerina.

import ballerina/io;
public function main() {
    int m = 1;
    int n = 0xFFFF;

Integer literals can be hexadecimal (but not octal).

    n += m;

You can use compound assignment operations such as += and -=.

    io:println(n);
}
bal run integers.bal
65536