\
Operator
Divides one number by a second number and gives an integer result.
Syntax
expression_1 \ expression_2
Parts
expression_1
- A numeric expression, also known as the numerator.
expression_2
- A numeric expression, also known as the denominator.
Data types
A given expression can have one of the available numeric data types. It can be signed integer, unsigned integer, floating-point, or fixed-point.
The result is the integer quotient of expression_1
divided by expression_2
.
It discards the remainder and keeps only the integer part.
This is known as truncation.
The result data type is a numeric type applicable given the data types of expression_1
and expression_2
.
See the table “Integer arithmetic” in Data Types of Operator Results.
The operator /
is different from \
in what it returns.
The operator /
returns the full quotient, which keeps the remainder after the decimal point.
Instructions
TODO
Division by zero
If expression_2
has the value zero, the operator \
causes an exception DivideByZeroError
.
Examples
result1 = 42 \ 2
result2 = 21 \ 2
result3 = 100 \ -3
result4 = -3 \ 100
result1 | 21 |
---|---|
result2 | 10 |
result3 | -33 |
result4 | 0 |
See also
Other elements that use this symbol
- File-path strings (for example,
"foo"\"bar"
). See String Data Type.