v2026.5.3
All Bundles
Bundle Core runtime library providing primitive types (Bool, Byte, Char, Int, Float, String), base collections, and system utilities. Every Objeck program links against this bundle automatically via lang.obl.

Int

Integer class represents an operating system long value

Inherits: Number
n := Int->Random(100);         # random 0–99
abs := Int->Abs(-42);          # 42
mx  := Int->Max(10, 20);       # 20
Int->Sort(v);                  # sort int array in-place

Operations

Abs # function

Returns the absolute value

function : Abs() ~ Int

Return

TypeDescription
Intabsolute value

Example

Int->Abs(-99)->PrintLine();  # 99

Cbrt # function

Calculates the cube root

function : Cbrt() ~ Int

Return

TypeDescription
Intcube root value

Clamp # function

Returns a given value between an upper and lower bound

function : Clamp(min:Int, value:Int, max:Int) ~ Int

Parameters

NameTypeDescription
minIntminimal value
valueIntvalue between the min and max
maxIntmaximum value

Return

TypeDescription
Intmin if vaule is less than main, max if max is less than value, otherwise the value

Clear # function

Set all array elements to zero

function : Clear(a:Int[]) ~ Nil

Parameters

NameTypeDescription
aIntarray

Compare # native

Compares two values

function : native : Compare(l:Int, r:Int) ~ Int

Parameters

NameTypeDescription
lIntleft compare object
rIntright compare object

Return

TypeDescription
Int0 if equal, -1 if types differ, 1 if equal

DoubleFactorial # native

Calculates the double factorial of the value

function : native : DoubleFactorial(n:Int) ~ Int

Parameters

NameTypeDescription
nIntnumber

Return

TypeDescription
Intdouble factorial of the value

Error # function

Prints error value

function : Error() ~ Nil

ErrorLine # function

Prints error value with newline

function : ErrorLine() ~ Nil

Factorial # native

Calculates the factorial of the value

function : native : Factorial(n:Int) ~ Int

Parameters

NameTypeDescription
nIntnumber

Return

TypeDescription
Intfactorial of the value

Inf # function

Returns a positive infinity value

function : Inf() ~ Int

Return

TypeDescription
Intpositive infinity value

IsNeg # function

Checks is a number is negative

function : IsNeg() ~ Bool

Return

TypeDescription
Booltrue if negative, false otherwise

Max # native

Returns the largest integer value

function : native : Max(l:Int, r:Int) ~ Int

Parameters

NameTypeDescription
lIntvalue to compare
rIntvalue to compare

Return

TypeDescription
Intlargest integer value

Example

Int->Max(3, 7)->PrintLine();  # 7

MaxSize # function

Returns the maximum size of an integer

function : MaxSize() ~ Int

Return

TypeDescription
Intmaximum size of an integer

Min # native

Returns the smallest integer value

function : native : Min(l:Int, r:Int) ~ Int

Parameters

NameTypeDescription
lIntvalue to compare
rIntvalue to compare

Return

TypeDescription
Intsmallest integer value

Example

Int->Min(3, 7)->PrintLine();  # 3

MinSize # function

Returns the minimum size of an integer

function : MinSize() ~ Int

Return

TypeDescription
Intmaximum size of an integer

NaN # function

Returns a NaN value

function : NaN() ~ Int

Return

TypeDescription
IntNaN value

NegInf # function

Returns a negative infinity value

function : NegInf() ~ Int

Return

TypeDescription
Intnegative infinity value

Pow # function

Calculates the power value

function : Pow(b:Int, r:Int) ~ Int

Parameters

NameTypeDescription
bIntpower base
rIntpower to raise

Return

TypeDescription
Intpseudo power value

Example

Int->Pow(2, 10)->PrintLine();  # 1024

Pow # function

Calculates the power value

function : Pow(b:Int, r:Float) ~ Float

Parameters

NameTypeDescription
bIntpower base
rFloatpower to raise

Return

TypeDescription
Floatpseudo power value

Print # function

Prints value

function : Print() ~ Nil

PrintLine # function

Prints value with newline

function : PrintLine() ~ Nil

PrintLine # native

Prints values

function : native : PrintLine(v:Int[]) ~ Nil

Parameters

NameTypeDescription
vIntvalues to print

PrintLine # native

Prints values

function : native : PrintLine(v:Int[,]) ~ Nil

Parameters

NameTypeDescription
vIntvalues to print

Random # function

Returns a pseudo random value between 0 and 1, inclusive

function : Random(range_start:Int, range_end:Int) ~ Int

Parameters

NameTypeDescription
range_startIntminimum value
range_endIntmaximum value

Return

TypeDescription
Intpseudo random value

Example

temp := Int->Random(-10, 40);
"Temp: {$temp}°C"->PrintLine();

Random # function

Returns a random number between 0 and max value, inclusive

function : Random(max:Int) ~ Int

Parameters

NameTypeDescription
maxIntmax value

Return

TypeDescription
Intrandom number within range

Example

dice := Int->Random(6) + 1;
"Rolled: {$dice}"->PrintLine();

Sign # function

Returns the sign of a number

function : Sign() ~ Int

Return

TypeDescription
Intsign of a number

Sqrt # function

Calculates the square root

function : Sqrt() ~ Int

Return

TypeDescription
Intsquare root value

Example

Int->Sqrt(144)->PrintLine();  # 12

ToBinaryString # native

Returns the binary string value

function : native : ToBinaryString() ~ String

Return

TypeDescription
Stringbinary string value

ToByte # function

Returns the Byte value

function : ToByte() ~ Byte

Return

TypeDescription
Bytevalue

ToChar # function

Returns the Character value

function : ToChar() ~ Char

Return

TypeDescription
Charvalue

ToCommaString # native

Returns a comma formatted string value

function : native : ToCommaString() ~ String

Return

TypeDescription
Stringstring value

ToFloat # function

Returns the Float value

function : ToFloat() ~ Float

Return

TypeDescription
Floatvalue

ToHexString # native

Returns a hex string value

function : native : ToHexString() ~ String

Return

TypeDescription
Stringhex string value

ToString # function

Returns the string value

function : ToString() ~ String

Return

TypeDescription
Stringstring value

Example

s := Int->ToString(255);
s->PrintLine();  # 255

ToString # native

Returns a string representation of the value

function : native : ToString() ~ String

Return

TypeDescription
Stringstring representation of the value

ToString # function

Returns a string representation of the int array

function : ToString(v:Int[,]) ~ String

Parameters

NameTypeDescription
vIntint array

Return

TypeDescription
Stringstring representation of the int array