Jump to navigation Jump to search
Revision as of 08:07, 11 February 2013 by
The DEFSNG statement defines all designated undefined variables AS SINGLE variables.
- DEFSNG letter[-range]
- The variable first letters can be from A-Z or any other range.
- You can also use commas for specific untyped variable first letters.
- Variables DIMensioned as another variable type or that use type suffixes are not defined otherwise.
- DEFSNG is normally the Qbasic default type assignment for undefined variables without type suffixes.
- DEFSNG sets the type of all variable names with the starting letter(s) or letter ranges when encountered in the progression of the program(even in conditional statement blocks not executed and subsequent SUB procedures).
- Qbasic's IDE may add DEF statements before any SUB or FUNCTION. QB64(like QB) will change all variable types in subsequent sub-procedures to that default variable type without giving a "Parameter Type Mismatch" warning or adding the proper DEF statement to subsequent procedures! If you do not want that to occur, either remove that DEF statement or add the proper DEF type statements to subsequent procedures. May also affect $INCLUDE procedures!
- Warning: Qbasic keyword names cannot be used as numerical variable names with or without the type suffix!
Example: DEFSNG A-D, S