BASIC stamp manual v2.2

3: Using the BASIC Stamp Editor
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 73
#IF…#THEN is a conditional compile structure similar to the run-time
IF…THEN command except that, at compile time, #IF…#THEN evaluates
Condition(s) and, if it is True, compiles the Statement(s) following #THEN,
otherwise it compiles the Statement(s) following #ELSE.
Condition is a statement that can be evaluated as True or False
during compile-time.
Statement is any valid PBASIC instruction.
Example:
' {$PBASIC 2.5}
' set Baud for 9600-N81
#IF ($STAMP = BS2sx) OR ($STAMP = BS2p) #THEN
Baud CON 16624
#ELSE
#IF ($STAMP = BS2px)
Baud CON 16780
#ELSE
Baud CON 16468
#ENDIF
#ENDIF
In this example, the constant Baud is set to an appropriate value for the
BASIC Stamp that is specified in the $STAMP directive (not shown). This
code will work with the BS2, BS2e, BS2sx, BS2p, BS2pe, and BS2px.
One important thing to note is that the $STAMP directive is used here as a
compile-time symbol, as if it were defined by #DEFINE. The compiler
treats all the editor directives, $STAMP, $PBASIC and $PORT as “defined”
compile-time symbols set equal to the respective value used in their
declaration. At the time of this writing, using $PBASIC in this fashion is
pointless since the conditional-compile directives are only supported in
PBASIC 2.5, and would cause an error if compiled in any other version of
the language.