Long Statement
Declares variables of type long integer. (4 byte whole number).
Syntax
Long varName [(subscripts)] [, varName [(subscripts)]...]
Parameters
- varName
- Specify the variable name to declare as the Long type. subscripts: Optional. Dimensions of an array variable; up to 3 dimensions may be declared. The subscripts syntax is as follows
(ubound1, [ubound2], [ubound3])
ubound1, ubound2, ubound3 each specify the maximum upper bound for the associated dimension. The elements in each dimension of an array are numbered from 0 and the available number of array elements is the upper bound value + 1. When specifying the upper bound value, make sure the number of total elements is within the range shown below:- Local variable: 2,000
- Global Preserve variable: 4,000
- Global variable and module variable: 100,000
Description
Long is used to declare variables as type Long. Variables of type Long can contain whole numbers with values between -2,147,483,648 to 2,147,483,647. Local variables should be declared at the top of a function. Global and module variables must be declared outside of functions.
See Also
Boolean, Byte, Double, Global, Int32, Int64, Integer, Real, Short, String, UByte, UInt32, UInt64, UShort
Long Statement Example
The following example shows a simple program which declares some variables as Longs using Long.
Function longtest
Long A(10) 'Single dimension array of long
Long B(10, 10) 'Two dimension array of long
Long C(5, 5, 5) 'Three dimension array of long
Long var1, arrayVar(10)
Long i
Print "Please enter a Long Number"
Input var1
Print "The Integer variable var1 = ", var1
For i = 1 To 5
Print "Please enter a Long Number"
Input arrayVar(i)
Print "Value Entered was ", arrayVar(i)
Next I
Fend