Udostępnij za pośrednictwem


How to: Hold Fractions in a Variable

A variable holds numbers with fractions if you declare it to be of type Double. The Double Data Type (Visual Basic) can hold floating-point numbers from -1.79769313486231570E+308 through 1.79769313486231570E+308.

You can also use the Single Data Type (Visual Basic) or the Decimal Data Type (Visual Basic) to hold fractions. For more information, see Numeric Data Types.

To hold fractions in a variable

  1. Declare the variable with a Dim Statement (Visual Basic).

  2. Follow the variable name with an As clause.

  3. Follow the As keyword with the Double keyword.

See Also

Concepts

Type Characters

Numeric Data Types

Reference

Data Type Summary (Visual Basic)

Other Resources

Elementary Data Types