lang • type • integer

Integer

DIM Var AS Integer

This native datatype represents an Integer value, i.e. a four byte signed integer value.

The value of an Integer is between -2147483648 and +2147483647. (-2^31 and 2^31-1) For larger integers, use Long.

Integer values can be written in decimal, hexadecimal, or binary

Hexadecimal values are preceded by & or by &H or &h

Binary values are preceded by &X or &x

hexadecimal constants with a value which would fit in 4 digits are sign expanded from bit 15 to bits 16 to 31, if no trailing & is added to the constant. Consider this when defining colors as constants : &H0000FF00 will be yellow (same as &H00FFFF00, because it will be sign expanded to &HFFFFFF00) where &H0000FF00& will be green.

constant

decimal hexadecimal
&HC000 the sign will be extended -16384 FFFFC000
&HC000& no extension of sign 49152 0000C000
&H1C000 no sign extension 114688 0001C000

See also