# Difference between revisions of "DEFINE"

Jump to navigation
Jump to search

imported>Clippy m |
imported>Clippy m |
||

Line 19: | Line 19: | ||

''Explanation:'' Variables that start with the letters A, B, C or F will now be defined as unsigned integers. Unsigned integers can only use positive values while ordinary integers can also use negative values. | ''Explanation:'' Variables that start with the letters A, B, C or F will now be defined as unsigned integers. Unsigned integers can only use positive values while ordinary integers can also use negative values. | ||

− | ''Example 2:'' How negative assignments affect the _UNSIGNED value | + | |

+ | |||

+ | ''Example 2:'' How negative assignments affect the _UNSIGNED value returned by a byte(8 bits). | ||

::::00000001 - unsigned & signed are both 1 | ::::00000001 - unsigned & signed are both 1 |

## Revision as of 23:49, 2 October 2009

_DEFINE lets you define a range of variables according to their first character as a datatype.

*Syntax:* _DEFINE range or letter[, range2 or letter2[, range3 or letter3[, ...]]] AS [ _UNSIGNED ] datatype

- Range is in the form firstletter-endingletter (like A-C) or just define a single letter as a datatype.
- Datatypes: INTEGER, SINGLE, DOUBLE, LONG, STRING, _BIT, _BYTE, _INTEGER64, _FLOAT
- Can also use the prefix _UNSIGNED for positive numerical values only.

*Example 1:*

*Explanation:* Variables that start with the letters A, B, C or F will now be defined as unsigned integers. Unsigned integers can only use positive values while ordinary integers can also use negative values.

*Example 2:* How negative assignments affect the _UNSIGNED value returned by a byte(8 bits).

- 00000001 - unsigned & signed are both 1
- 01111111 - unsigned & signed are both 127
- 11111111 - unsigned is 255 but signed is -1
- 11111110 - unsigned is 254 but signed is -2
- 11111101 - unsigned is 253 but signed is -3

*See also:* DIM, DEFSTR, DEFLNG, DEFINT, DEFSNG, DEFDBL, _UNSIGNED, ABS, SGN

*Referance:* Mathematical Operations