Integer
Operators and functions for working with integers of int type are described here.
Operators
Operator | Result | Description |
int ? | bool | true, if the number doesn't equal zero. |
int + int | int | The addition of two integers. |
int - int | int | Subtract two integers. |
int * int | int | Multiplication of two integers. |
int / int | int | The division of two integers. When dividing by zero, an error is returned. |
int == int | bool | Returns true if two numbers are equal and false, otherwise. |
int > int | bool | Returns true if the first number is greater than the second and false, otherwise. |
int < int | bool | Returns true if the first number is less than the second and false, otherwise. |
int != int | bool | Returns true if two numbers are not equal and false, otherwise. |
int >= int | bool | Returns true if the first number is greater than or equal to the second and false, otherwise. |
int <= int | bool | Returns true if the first number is less than or equal to the second and false, otherwise. |
int % int | int | Returns the remainder after dividing two numbers (modulo operator). |
int | int | int | Bitwise OR. |
int ^ int | int | Bitwise XOR. |
int & int | int | Bitwise AND. |
int << int | int | Bitwise left shift. |
int >> int | int | Bitwise right shift. |
- int | int | Change the sign of an integer. |
^ int | int | Bitwise NOT. |
int = int | int | Simple assignment operator. |
int = char | int | Assigning a character to a variable. |
int += int | int | Add and assignment operator. |
int -= int | int | Subtract and assignment operator. |
int /= int | int | Divide and assignment operator. |
int *= int | int | Multiply and assignment operator. |
int %= int | int | Modulus and assignment operator. |
int |= int | int | Bitwise and assignment operator. |
int ^= int | int | Bitwise exclusive OR and assignment operator. |
int &= int | int | Bitwise inclusive OR and assignment operator. |
int <<= int | int | Left shift and assignment operator. |
int >>= int | int | Right shift AND assignment operator. |
Functions
Abs(int i) int
The Abs function returns the absolute value of the number.
bool(int i) bool
The bool function returns false if the passed parameter is 0, otherwise it returns true.
float(int i) float
The float function converts an integer to a float number.
Max(int l, int r) int
The Max function returns the maximum of two values.
Min(int l, int r) int
The Min function returns the minimum of two values.
Random(int n) int
The Random function returns a non-negative pseudo-random number in [0,n).
str(int i) str
The str function converts an integer to a string.
Last updated