Signed 64-bit integer type. This means that it can take values from -2^63
to 2^63 - 1
, i.e. from -9223372036854775808
to 9223372036854775807
. When it exceeds these bounds, it will wrap around.
ints can be automatically converted to floats when necessary, for example when passing them as arguments in functions. The float will be as close to the original integer as possible.
Likewise, floats can be automatically converted into ints. This will truncate the float, discarding anything after the floating point.
You can use the 0b
literal for binary representation, the 0x
literal for hexadecimal representation, and the _
symbol to separate long numbers and improve readability.
Constructs an int set to 0
.
Constructs an int as a copy of the given int.
Constructs a new int from a String, following the same rules as String.to_int.
Constructs a new int from a bool. true
is converted to 1
and false
is converted to 0
.
Constructs a new int from a float. This will truncate the float, discarding anything after the floating point.
Returns true
if the int is not equivalent to the float.
Returns true
if the ints are not equal.
Returns the remainder after dividing two ints. Uses truncated division, which returns a negative number if the dividend is negative. If this is not desired, consider using @GlobalScope.posmod.
Performs the bitwise AND
operation.
This is useful for retrieving binary flags from a variable.
Multiplies each component of the Color by the int.
Multiplies each component of the Quaternion by the int. This operation is not meaningful on its own, but it can be used as a part of a larger expression.
Multiplies each component of the Vector2 by the int.
Multiplies each component of the Vector2i by the int.
Multiplies each component of the Vector3 by the int.
Multiplies each component of the Vector3i by the int.
Multiplies each component of the Vector4 by the int.
Multiplies each component of the Vector4i by the int.
Multiplies the two ints.
Raises the left int to a power of the right int.
Adds the two ints.
Subtracts the two ints.
Divides the two ints. The result is an int. This will truncate the float, discarding anything after the floating point.
Returns true
if the int is less than the float.
Returns true
if the left int is less than the right int.
Performs the bitwise shift left operation. Effectively the same as multiplying by a power of 2.
Returns true
if the int is less than or equal to the float.
Returns true
if the left int is less than or equal to the right int.
Returns true
if the int is equal to the float.
Returns true
if the two ints are equal.
Returns true
if the int is greater than the float.
Returns true
if the left int is greater than the right int.
Returns true
if the int is greater than or equal to the float.
Returns true
if the left int is greater than or equal to the right int.
Performs the bitwise shift right operation. Effectively the same as dividing by a power of 2.
Performs the bitwise XOR
operation.
Returns the same value as if the +
was not there. Unary +
does nothing, but sometimes it can make your code more readable.
Returns the negated value of the int. If positive, turns the number negative. If negative, turns the number positive. If zero, does nothing.
Performs the bitwise OR
operation.
This is useful for storing binary flags in a variable.
Performs the bitwise NOT
operation on the int. Due to 2's complement, it's effectively equal to -(int + 1)
.