/ Operator
Visual Studio .NET 2003
Divides two numbers and returns a floating-point result.
number1 / number2
Parts
- result
- Required. Any numeric variable.
- number1
- Required. Any numeric expression.
- number2
- Required. Any numeric expression.
Result
The result is the quotient of number1 divided by number2.
Supported Types
Byte, Short, Integer, Long, Single, Double, Decimal
Remarks
The data type of result is usually Double. The following are exceptions to this rule:
| If | Then result is |
|---|---|
| One expression is Single and the other is any data type except Double | Single. |
| Both expressions are Decimal data types | Decimal. If a Decimal expression is divided by 0, a DividebyZero exception is raised. This exception only occurs with a Decimal expression. |
If an expression is stated as Nothing, or is Empty, it is treated as zero.
Example
This example uses the / operator to perform floating-point division. The result is the quotient of the two operands.
Dim MyValue As Double MyValue = 10 / 4 ' Returns 2.5. MyValue = 10 / 3 ' Returns 3.333333.
See Also
\= Operator | \ Operator | Arithmetic Operators | Operator Precedence in Visual Basic | Operators Listed by Functionality | Arithmetic Operators