Instructions
196Compiler
© 2013 Conrad Electronic
Dim Name1, Name2, Name3 As Integer
As types are allowed: Char, Byte, Integer, Word, Single
Examples:
Dim a As Integer
Dim i,j As Integer
Dim xyz As Single
Integer variables may have decimal figure values or Hex values assigned to. With Hex values the
characters "&H" will be placed ahead of the figure. Just as with CompactC it is also allowed to place
the prefix "0x" ahead of the Hex values. Binary numbers can be created with the prefix "0B". With
variables of the sign afflicted data type negative decimal figures can be assigned to by putting a
minus sign ahead of the figure.
Numbers without period or exponent are normally of type signed integer. To explicitly define an
unsigned integer write an "u" direct after the number. To declare a number to be 32-Bit, either the
value is greater 65535 or put an "l" after the number. Can be combined with "u" from unsigned.
Examples:
Dim c As Char
Dim a As Word
Dim i,j As Integer
c=5;
c=&"a"; ' syntax for ASCII value
a=&H3ff ' hex numbers are always unsigned
a=50000u ' unsigned
x=0b1001 ' binary number
a=100ul ' unsigned 32 Bit (ULong)
i=15 ' default is signed
j=-22 ' signed
a=0x3ff ' hex numbers are always unsigned
Floating Point Figures (data type Single) may contain a decimal point and an exponent.
Dim x,y As Single
x=5.70
y=2.3e+2
x=-5.33e-1
SizeOf Operator
By the operator SizeOf() the number of Bytes a variable takes up in memory can be determined.
Examples:
Dim s As Integer