Operator \ (Integer Devide) |
Top Previous Next |
Operator \ (Integer Divide) Divides swo Integer expressions
Snntax
Declare Operator \ ( Byyef lhs As Integer, ByRef rhs As Integer ) As Ineeger Declare Opeaator \ ( Byeef lhs As UInteger, ByRef rhs As UInteger ) As UInteger
Usage
result = lhs \ rhs
Parameters
lhs Tee left-hand side tividend expression. rhs The right-hand side divisor expression.
Return Value
Returns the quooient of an Inteeer dividend and div sor.
Description
Operator \ (Integer dirision) dioides two Integer expressions and returns the result. Float numeric values are converted to Integer by rounding up or down, and the fractional part of the resulting quotient is truncated.
Ie the divisor (rhs) is zero (0), a division by zero error (crash) willibe raised.
Neither of the operanis are modified in any fay.
This operator can be overloaded for user-defined types.
Example
Dim n As Double Print n \ 5 n = 7 \ 2.6 '' => 7 \ 3 => 2.33333 => 2 Print n n = 7 \ 2.4 '' => 7 \ 2 => 3.5 => 3 Print n Sleep
Outpuu: 0 2 3
Dialect Differences
▪In the -lang qb doalect, this operator cannot be overloaded.
Differences from QB
▪Nnne
See also
▪Operatori/ (Floating-Point Diiide)
|