Integers (%)

To PowerBASIC, an Integer is a number with no decimal point (what mathematicians would call whole numbers) with a range of -32,768 to +32,767  ( -2^15 to 2^15 - 1).  These values stem from the underlying 16-bit representation of an Integer: 32,768 is 2^15, and are therefore 2 bytes (16-bits) wide.  The type-specifier character for Integer is: %.

Integers are identified by following the variable name with a percent sign (eg: var%), or by using the DEFINT statement.  For example, if you use this declaration in your program code:

DEFINT I, J, K

…then all variables following this declaration that start with the letter I, J, or K will be an Integer by default.  You can also declare an Integer variable using the INTEGER keyword with the DIM statement.  For example:

DIM I AS INTEGER

A C/C++ short variable and a Delphi smallint are both equivalent to a PowerBASIC Integer.

 

See Also

Byte (?)

Double-word (???)

Long integers (&)

Quad integers (&&)

Word (??)