variables and constants

Questions about the BASICtools and MakeItC
Post Reply
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

variables and constants

Post by YahooArchive »

> In reference to variables and constants, can you dim and initialize
> them before the MAIN: in the programming? Or must they always be
> dimensioned and initialized within MAIN?

Strings or arrays must be dimensioned before their first use. Simple
variables can be dimensioned or not. By default they are
auto-allocated. But once a simple variable is DIM'd then all simple
variables following that must be DIM'd.

DIM is a compile time operation, in that it produces no code, it just
allocates variable space in the order that it is encountered. So
DIM's don't have to follow the MAIN: Currently variables can not be
initialized in the DIM statement.

Constants can be declared either with CONST or using the pre-processor
#define. In either case they generate no code, so they only need to
be declared before their first use.

Post Reply