|
Navigation: thinBasic language > Data types and variables > Numeric Equates |
![]() ![]()
|
Numeric equates
thinBasic allows you to refer to numeric constants by name. Those constant values are called equates.
Equates data type
Equates declaration has the following syntax:
%EquateName = NumericExpression [As NumericDataType]
Where the optional parameter NumericDataType can be any of the allowed numeric data types: BYTE, INTEGER, WORD, DWORD, LONG, QUAD, SINGLE, DOUBLE, EXTENDED, CURRENCY.
If not NumericDataType is specified, default type will be assumed to be LONG.
Examples
Some equate declaration example:
%MAXPIECES = 32
%NPARAM = 3
%NTYPE = 1
%RANK = 2
%FILE = 3
%KING = 1
%PAWN = 2
%MAXVALUE = 0.999 AS EXT
Restrictions
| 1. | Numeric equates name must start with percent sign % |
| 2. | Unlike variables, you can use an equate on the left side of an assignment statement only once. |
| 3. | If an equate has already been created, subsequent attempts to assign a new value will fail but no error will be generated |
| © 2004-2008 thinBasic. All rights reserved. | Version 1.6.0.10 | Web Site: http://www.thinbasic.com |