BASIC stamp manual v2.2
Using the BASIC Stamp Editor
Page 74 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
#SELECT Expression
#CASE Condition(s)
Statement(s)
{ #CASE Condition(s)
Statement(s)
#CASE #ELSE
Statement(s) }
#ENDSELECT
#SELECT…#CASE is a conditional compile structure similar to the run-
time SELECT…CASE command except that, at compile time,
#SELECT…#CASE evaluates Expression and then conditionally compiles a
block of code based on comparison to Condition(s). If no Conditions are
found to be True and a #CASE #ELSE block is included, the Statement(s) in
the #CASE #ELSE block will be compiled.
• Expression is a statement that can be evaluated as True or False
during compile-time.
• Condition is a statement, that when compared to Expression,
can be evaluated as True or False. Multiple conditions within
the same CASE can be separated by commas ( , ).
• Statement is any valid PBASIC instruction.
Example:
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2, BS2e, BS2sx
GOSUB LCD_Write
#CASE #ELSE
LCDOUT LCDpin, cmd, [char]
#ENDSELECT
This example checks the $STAMP directive at compile-time and either
compiles
GOSUB LCD_Write
- or –
LCDOUT LCDpin, cmd, [char] into the program.
#SELECT...#CASE SYNTAX.