Defining Constants

PB/Win constants (also known as equates) are defined by prefixing the name of the constant with a "%" character. MSBASIC and VB define constants with the CONST keyword. The MSBASIC/VB compiler then does type conversions at the point of use, if the constant's type was not specified. That overhead does not happen (and is not necessary) with PB/Win. String equates are specified with a leading "$" character.

However, the MACRO facilities in PB/Win offer a way to retain the CONST syntax in your code, while maintaining the low overhead advantage of PowerBASIC. For example:

MACRO CONST = MACRO

[statements]

CONST Something = 1&

CONST Something_Else = 2???

CONST AppTitle = "My Application"

[statements]

MSGBOX FORMAT$(Something), ,AppTitle

During compilation, the CONST keyword is replaced by the MACRO word, which dynamically creates a new macro that, in turn, defines a constant.

See Also

Constants and Literals

Numeric Equates

Built-in numeric equates

Built In RGB Color Equates

String Equates

Built-in string equates