Difference between revisions of "DEFINE"
Jump to navigation
Jump to search
Navigation:
imported>Cyperium m |
imported>Clippy m |
||
Line 10: | Line 10: | ||
* Datatypes: [[INTEGER]], [[SINGLE]], [[DOUBLE]], [[LONG]], [[STRING]], [[_BIT]], [[_BYTE]], [[_INTEGER64]], [[_FLOAT]] | * Datatypes: [[INTEGER]], [[SINGLE]], [[DOUBLE]], [[LONG]], [[STRING]], [[_BIT]], [[_BYTE]], [[_INTEGER64]], [[_FLOAT]] | ||
* Can also use the [[_UNSIGNED]] definition for positive numerical values only. | * Can also use the [[_UNSIGNED]] definition for positive numerical values only. | ||
− | + | * '''Note: Qbasic's IDE may add DEF statements before any [[SUB]] or [[FUNCTION]]. QB64 will change all variable types in subsequent sub-procedures to that default variable type without giving a [[ERROR Codes|"Parameter Mismatch"]] warning! If you do not want that to occur, either remove that DEF statement or add the proper type statements to subsequent procedures.''' | |
Revision as of 18:41, 11 February 2011
_DEFINE defines a range of variable names according to their first character as a datatype.
Syntax
Description
- Variable start letter range is in the form firstletter-endingletter (like A-C) or just a single letter.
- Datatypes: INTEGER, SINGLE, DOUBLE, LONG, STRING, _BIT, _BYTE, _INTEGER64, _FLOAT
- Can also use the _UNSIGNED definition for positive numerical values only.
- Note: Qbasic's IDE may add DEF statements before any SUB or FUNCTION. QB64 will change all variable types in subsequent sub-procedures to that default variable type without giving a "Parameter Mismatch" warning! If you do not want that to occur, either remove that DEF statement or add the proper type statements to subsequent procedures.
Examples
_DEFINE A-C, F AS _UNSIGNED INTEGER
Explanation: Any undefined 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.
See also
Reference: Mathematical Operations