Difference between revisions of "$LET"

From QB64 Wiki
Jump to navigation Jump to search
m (Fix typo)
Line 8: Line 8:
{{PageDescription}}
{{PageDescription}}
* Unlike [[LET]], [[$LET]] is not optional.
* Unlike [[LET]], [[$LET]] is not optional.
* $LET a = 12 sets a precompiler variable "a" to the value of 12.  This variable is only valid for the precompiler itself and does nothing to affect the values of any variable/constant which might also be called "a" in the program.
* $LET A = 12 sets a precompiler variable "a" to the value of 12.  This variable is only valid for the precompiler itself and does nothing to affect the values of any variable/constant which might also be called "a" in the program.
* Variable names can contain numbers, letters, and periods in any order. [[$LET]] '''3.2 = TRUE''' is a perfectly valid variable and expression.
* Variable names must follow QB64's variable naming conventions.
* Expressions can contain one set of leading and/or trailing quotes; and any number of numbers, letters, and periods, in any order. [[$LET]] '''3.2 = "TRUE"''' is also perfectly valid, but [[$LET]] '''3.2 = ""TRUE""''' will error because of the double quotes.
* You can check a precompiler variable against special values '''DEFINED''' and '''UNDEFINED''', in order to assess whether the variable has already been assigned a value. Useful for code in libraries which may be repeated.
* You can check a precompiler variable against special values '''DEFINED''' and '''UNDEFINED''', in order to assess whether the variable has already been assigned a value. Useful for code in libraries which may be repeated.



Revision as of 16:28, 9 October 2021

$LET is a precompiler command, which is now usable by modern day cavemen to help include and exclude which sections of code compiles in their program based on OS/bit-size or other predefined conditions.


Syntax

$LET variable = expression


Description

  • Unlike LET, $LET is not optional.
  • $LET A = 12 sets a precompiler variable "a" to the value of 12. This variable is only valid for the precompiler itself and does nothing to affect the values of any variable/constant which might also be called "a" in the program.
  • Variable names must follow QB64's variable naming conventions.
  • You can check a precompiler variable against special values DEFINED and UNDEFINED, in order to assess whether the variable has already been assigned a value. Useful for code in libraries which may be repeated.


Examples

  • See example 1 in $IF.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page