.if
.if
marks the beginning of a section of code which is only
considered part of the source program being assembled if the argument
(which must be an absolute expression) is non-zero. The end of
the conditional section of code must be marked by .endif
(see
.endif
); optionally, you may include code for the
alternative condition, flagged by .else
(see
.else
).
If you have several conditions to check, .elseif
may be used to avoid
nesting blocks if/else within each subsequent .else
block.
The following variants of .if
are also supported:
.ifdef
symbol
.ifb
text
.ifc
string1
,
string2
.ifeq
absolute expression
.ifeqs
string1
,
string2
.ifc
. The strings must be quoted using double quotes.
.ifge
absolute expression
.ifgt
absolute expression
.ifle
absolute expression
.iflt
absolute expression
.ifnb
text
.ifb
, but the sense of the test is reversed: this assembles the
following section of code if the operand is non-blank (non-empty).
.ifnc
string1
,
string2
.
.ifc
, but the sense of the test is reversed: this assembles the
following section of code if the two strings are not the same.
.ifndef
symbol
.ifnotdef
symbol
.ifne
absolute expression
.if
).
.ifnes
string1
,
string2
.ifeqs
, but the sense of the test is reversed: this assembles the
following section of code if the two strings are not the same.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.