Variables represent
The Single-precision
variables, EndOfMonthTotals and emt, both require exactly
four bytes of run-time storage. A good rule of thumb is to preserve
a balance, keeping variable names short enough so that statements can
fit on one line. Many programmers use single-letter variables for
PowerBASIC has many built-in variable types: Dynamic string; Fixed-length string; ASCIIZ string; Field, Integer; Long integer; Quad integer; Byte, Word; Double word; Single; Double; and Extended floating point; Currency and CurrencyX; Variant, Object, Guid, plus Pointer, arrays, and Bit and Sbit bitfield subtypes.
Use the DIM statement to declare a variable and use the AS type syntax:
DIM iVar AS INTEGER
bat# = 1.312 ' bat# is a Double-precision variable
hat% = 3 ' hat% is an Integer variable
DEFINT c ' Variables beginning with c are now Integer
cats = 16 ' cats is an Integer variable by DEFINT
Bear in mind that cat?, cat%, cat&, cat&&, cat!, cat#, cat##, cat@, cat@@, and cat$ are ten separate variables. Although using cat over and over again to create different variables like this is legal, good programming practice suggests that you use somewhat different names for different variables. It is also much better to use descriptive and more easily understood names for your variables rather than single letters. It's extremely difficult to debug a program in which x@ has been entered instead of x! or x#. Imagine the confusion of trying to distinguish x&& and x&. If you had used variable names like count!, result#, remain##, and company$, you would have had considerably less trouble keeping your variables (and their types) apart.
See Also
LOCAL, GLOBAL and STATIC considerations