Int
classin packageklyn
public class Int extends AbstractSignedInt implements ValueType:
All Implemented Interfaces: ValueType

Represents a 32-bit signed integer.

The Int type is a value type that stores integers ranging from -2,147,483,648 to 2,147,483,647.

Example
a = 42
b = Int(3.14)
print(a + b) # 45
Fields
Modifier and Type Member Description
public const MAX_VALUE
MAX_VALUE as Int = 2_147_483_647
The greatest value representable by an Int.
public const MIN_VALUE
MIN_VALUE as Int = -2_147_483_648
The smallest value representable by an Int.
Inherited Properties
propertyInherited Properties from Object: type
Constructors
Modifier and Type Member Description
public native Int
Int()
Builds the neutral Int value (0).
public native Int
Int(value as Boolean)
Conversion from a Boolean value.
public native Int
Int(value as Char)
Builds an Int from a Unicode scalar value.
public native Int
Int(value as CodeUnit)
Converts one UTF-16 code unit to its unsigned 16-bit numeric value.
public native Int
Int(value as Double)
Conversions from double precision floating point numbers.
public native Int
Int(value as Float)
Conversions from floating point numbers (truncates the decimal part).
public native Int
Int(value as Int)
Copy constructor.
public native Int
Int(value as Long)
Conversion from signed 64-bit integer (Long).
public native Int
Int(value as String) throws ValueException
Parses a string into an integer.
public native Int
Int(value as UInt)
Conversion from unsigned 32-bit integer.
public native Int
Int(value as ULong)
Conversion from unsigned 64-bit integer.
Methods
Modifier and Type Member Description
public native override toString
toString() as String
Returns a string representation of this integer.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toString, toXml
Operators
Modifier and Type Member Description
public native static operator!=( readonly a as Int, readonly b as Int ) as Boolean Tests whether two Int values are different.
public native static operator%( readonly a as Int, readonly b as Int ) as Int Computes the remainder of one Int value divided by another.
public native static operator%=( readonly a as Int, readonly b as Int ) as Void Replaces a with the remainder of a divided by b.
public native static operator*( readonly a as Int, readonly b as Int ) as Int Multiplies two Int values.
public native static operator**( readonly value as Int, readonly power as UInt ) as Int Raises an Int value to a power.
public native static operator**=( readonly value as Int, readonly power as UInt ) as Void Replaces value with value ** power.
public native static operator*=( readonly a as Int, readonly b as Int ) as Void Multiplies a by b in place.
public native static operator+( readonly a as Int, readonly b as Int ) as Int Adds two Int values.
public native static operator+=( readonly a as Int, readonly b as Int ) as Void Adds b to a in place.
public native static operator-( readonly a as Int, readonly b as Int ) as Int Subtracts one Int value from another.
public native static operator-=( readonly a as Int, readonly b as Int ) as Void Subtracts b from a in place.
public native static operator/( readonly a as Int, readonly b as Int ) as Double Divides one Int value by another.
public native static operator//( readonly a as Int, readonly b as Int ) as Int Performs integer division on two Int values.
public native static operator//=( readonly a as Int, readonly b as Int ) as Void Replaces a with the integer division of a by b.
public native static operator<( readonly a as Int, readonly b as Int ) as Boolean Tests whether a is strictly lower than b.
public native static operator<=( readonly a as Int, readonly b as Int ) as Boolean Tests whether a is lower than or equal to b.
public native static operator==( readonly a as Int, readonly b as Int ) as Boolean Tests whether two Int values are equal.
public native static operator>( readonly a as Int, readonly b as Int ) as Boolean Tests whether a is strictly greater than b.
public native static operator>=( readonly a as Int, readonly b as Int ) as Boolean Tests whether a is greater than or equal to b.