Int
Integer class represents an operating system long value
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-placeOperations
- Abs
- Cbrt
- Clamp
- Clear
- Compare
- DoubleFactorial
- Error
- ErrorLine
- Factorial
- Inf
- IsNeg
- Max
- MaxSize
- Min
- MinSize
- NaN
- NegInf
- Pow
- PrintLine
- Random
- Sign
- Sqrt
- ToBinaryString
- ToByte
- ToChar
- ToCommaString
- ToFloat
- ToHexString
- ToString
Abs # function
Returns the absolute value
function : Abs() ~ IntReturn
| Type | Description |
|---|---|
| Int | absolute value |
Example
Int->Abs(-99)->PrintLine(); # 99Cbrt # function
Calculates the cube root
function : Cbrt() ~ IntReturn
| Type | Description |
|---|---|
| Int | cube root value |
Clamp # function
Returns a given value between an upper and lower bound
function : Clamp(min:Int, value:Int, max:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| min | Int | minimal value |
| value | Int | value between the min and max |
| max | Int | maximum value |
Return
| Type | Description |
|---|---|
| Int | min 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[]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| a | Int | array |
Compare # native
Compares two values
function : native : Compare(l:Int, r:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| l | Int | left compare object |
| r | Int | right compare object |
Return
| Type | Description |
|---|---|
| Int | 0 if equal, -1 if types differ, 1 if equal |
DoubleFactorial # native
Calculates the double factorial of the value
function : native : DoubleFactorial(n:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| n | Int | number |
Return
| Type | Description |
|---|---|
| Int | double factorial of the value |
Factorial # native
Calculates the factorial of the value
function : native : Factorial(n:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| n | Int | number |
Return
| Type | Description |
|---|---|
| Int | factorial of the value |
Inf # function
Returns a positive infinity value
function : Inf() ~ IntReturn
| Type | Description |
|---|---|
| Int | positive infinity value |
IsNeg # function
Checks is a number is negative
function : IsNeg() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if negative, false otherwise |
Max # native
Returns the largest integer value
function : native : Max(l:Int, r:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| l | Int | value to compare |
| r | Int | value to compare |
Return
| Type | Description |
|---|---|
| Int | largest integer value |
Example
Int->Max(3, 7)->PrintLine(); # 7MaxSize # function
Returns the maximum size of an integer
function : MaxSize() ~ IntReturn
| Type | Description |
|---|---|
| Int | maximum size of an integer |
Min # native
Returns the smallest integer value
function : native : Min(l:Int, r:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| l | Int | value to compare |
| r | Int | value to compare |
Return
| Type | Description |
|---|---|
| Int | smallest integer value |
Example
Int->Min(3, 7)->PrintLine(); # 3MinSize # function
Returns the minimum size of an integer
function : MinSize() ~ IntReturn
| Type | Description |
|---|---|
| Int | maximum size of an integer |
NegInf # function
Returns a negative infinity value
function : NegInf() ~ IntReturn
| Type | Description |
|---|---|
| Int | negative infinity value |
Pow # function
Calculates the power value
function : Pow(b:Int, r:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| b | Int | power base |
| r | Int | power to raise |
Return
| Type | Description |
|---|---|
| Int | pseudo power value |
Example
Int->Pow(2, 10)->PrintLine(); # 1024Pow # function
Calculates the power value
function : Pow(b:Int, r:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| b | Int | power base |
| r | Float | power to raise |
Return
| Type | Description |
|---|---|
| Float | pseudo power value |
PrintLine # native
Prints values
function : native : PrintLine(v:Int[]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Int | values to print |
PrintLine # native
Prints values
function : native : PrintLine(v:Int[,]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Int | values to print |
Random # function
Returns a pseudo random value between 0 and 1, inclusive
function : Random(range_start:Int, range_end:Int) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| range_start | Int | minimum value |
| range_end | Int | maximum value |
Return
| Type | Description |
|---|---|
| Int | pseudo 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) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| max | Int | max value |
Return
| Type | Description |
|---|---|
| Int | random number within range |
Example
dice := Int->Random(6) + 1;
"Rolled: {$dice}"->PrintLine();Sign # function
Returns the sign of a number
function : Sign() ~ IntReturn
| Type | Description |
|---|---|
| Int | sign of a number |
Sqrt # function
Calculates the square root
function : Sqrt() ~ IntReturn
| Type | Description |
|---|---|
| Int | square root value |
Example
Int->Sqrt(144)->PrintLine(); # 12ToBinaryString # native
Returns the binary string value
function : native : ToBinaryString() ~ StringReturn
| Type | Description |
|---|---|
| String | binary string value |
ToChar # function
Returns the Character value
function : ToChar() ~ CharReturn
| Type | Description |
|---|---|
| Char | value |
ToCommaString # native
Returns a comma formatted string value
function : native : ToCommaString() ~ StringReturn
| Type | Description |
|---|---|
| String | string value |
ToFloat # function
Returns the Float value
function : ToFloat() ~ FloatReturn
| Type | Description |
|---|---|
| Float | value |
ToHexString # native
Returns a hex string value
function : native : ToHexString() ~ StringReturn
| Type | Description |
|---|---|
| String | hex string value |
ToString # function
Returns the string value
function : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string value |
Example
s := Int->ToString(255);
s->PrintLine(); # 255