Difference between revisions of "DEFINE"

From QB64 Wiki
Jump to navigation Jump to search
Line 20: Line 20:
  
  
''Explanation:'' Variables that starts with A, B, C or F will now be defined as a unsigned integer, unsigned integers can only take positive values.
+
''Explanation:'' Variables that starts with A, B, C or F will now be defined as a unsigned integer, unsigned integers can only take positive values, ordinary integers can also take negative values.
  
  

Revision as of 21:55, 27 September 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 datatype


range is in the form firstletter-endingletter (like A-C)

If you want you can just define a single letter as a datatype.


datatype can be any of the following: INTEGER, SINGLE, DOUBLE, LONG, STRING, _BIT, _BYTE, _INTEGER64, _FLOAT


_BIT, _BYTE, _INTEGER64, INTEGER and LONG can also have the prefix _UNSIGNED


Example: _DEFINE A-C, F AS UNSIGNED INTEGER


Explanation: Variables that starts with A, B, C or F will now be defined as a unsigned integer, unsigned integers can only take positive values, ordinary integers can also take negative values.


See also: DEFSTR, DEFLNG, DEFINT, DEFSNG, DEFDBL, _UNSIGNED


Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage