
Identifier Type Characters
Visual Basic supplies a set of identifier type characters, which you can use in a declaration to specify the data type of a variable or constant. The following table shows the available identifier type characters with examples of usage.
Identifier type character
|
Data type
|
Example
|
|---|
%
|
Integer
|
Dim L%
|
&
|
Long
|
Dim M&
|
@
|
Decimal
|
Const W@ = 37.5
|
!
|
Single
|
Dim Q!
|
#
|
Double
|
Dim X#
|
$
|
String
|
Dim V$ = "Secret"
|
No identifier type characters exist for the Boolean, Byte, Char, Date, Object, SByte, Short, UInteger, ULong, or UShort data types, or for any composite data types such as arrays or structures.
In some cases, you can append the $ character to a Visual Basic function, for example Left$ instead of Left, to obtain a returned value of type String.
In all cases, the identifier type character must immediately follow the identifier name.