The WRspice input file syntax supports conditional blocks, through use of these directives. The expression can involve constants, parameter names from a .param line included in the file before the reference, or vectors and shell variables defined before the file is read. It does not understand variables implicitly set by inclusion in the .options line, or parameters set in .subckt lines or references. The scope for these constructs is always global, meaning that they apply to lines of text in the file without regard to .subckt block boundaries.
If the single expression is nonzero, or the two expressions yield the same result, the lines following .if up to the matching .elif, .else or .endif are read, and if an .else block follows, those lines to the matching .endif are discarded. If the single expression if zero or the two expressions do not match, the lines following .if to the matching .elif, .else or .endif are discarded, and if a .else line follows, the lines following .else to .endif are retained. These blocks can be nested. The action is similar to the C preprocessor.
This filtering is performed early in the parsing of the file, so that the .if, etc. lines can enclose script lines, verilog blocks, etc., and not simply circuit lines. The lines not in scope are never saved in memory. However, .include lines are read before the filtering is performed, so that even if a .include line is out of scope, if the file can not be opened, an error message will appear.