VarType: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "VARTYPE(''variable'') '''Description''' VARTYPE returns an integer that indicates the type of a variable. The required parameter, ''variable'', is any variable that doesn't ..."
 
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
VARTYPE(''variable'')
VarType(''variable'')


'''Description'''
== Description ==


VARTYPE returns an integer that indicates the type of a variable. The required parameter, ''variable'', is any variable that doesn't contain a user-defined type.
VarType returns an integer that indicates the type of a variable. The required parameter, ''variable'', is any variable that doesn't contain a user-defined type.


When ''variable'' is an array, the value returned is equal to the array constant plus the constant that specifies the element-type.
When ''variable'' is an array, the value returned is equal to the array constant plus the constant that specifies the element-type.


'''Table 25: VARTYPE return values'''
'''Table 25: VarType return values'''


{| class="wikitable"
{| class="wikitable"
Line 30: Line 30:
|}
|}


'''Example'''
== Example ==


<pre>
<pre>
REM VARTYPE Example
Rem VarType Example
'VARTYPE returns variable type as an integer
'VarType returns variable type as an integer
DIM nInteger, nSingle
Dim nInteger, nSingle
nInteger = CINT(44)
nInteger = CInt(44)
PRINT 44 & " is VARTYPE " & VARTYPE(nInteger)
Print 44 & " is VarType " & VarType(nInteger)
nSingle = CSNG(99.44)
nSingle = CSNG(99.44)
PRINT 99.44 & "isVARTYPE"&VARTYPE(nSingle)
Print 99.44 & "isVarType" & VarType(nSingle)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
44 is VARTYPE 2
44 is VarType 2
99.44 is VARTYPE 4
99.44 is VarType 4
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[isarray|ISARRAY]], [[isdate|ISDATE]], [[isempty|ISEMPTY]], [[isnull|ISNULL]], [[isnumeric|ISNUMERIC]], [[isobject|ISOBJECT]], [[typename|TYPENAME]]
[[is (operator)|IS]], [[typename|TYPENAME]]
 
[[Category:Language Reference]]

Revision as of 04:12, 17 August 2012

VarType(variable)

Description

VarType returns an integer that indicates the type of a variable. The required parameter, variable, is any variable that doesn't contain a user-defined type.

When variable is an array, the value returned is equal to the array constant plus the constant that specifies the element-type.

Table 25: VarType return values

Constant Value Description
vbInteger 2 Integer
vbDouble 5 Double-precision floating-point
vbCurrency 6 Currency
vbDate 7 Date
vbString 8 String
vbObject 9 Object
vbBoolean 11 Boolean
vbArray 8192 Array

Example

Rem VarType Example
'VarType returns variable type as an integer
Dim nInteger, nSingle
nInteger = CInt(44)
Print 44 & " is VarType " & VarType(nInteger)
nSingle = CSNG(99.44)
Print 99.44 & "isVarType" & VarType(nSingle)

Output

44 is VarType 2
99.44 is VarType 4

Related Items

IS, TYPENAME