TeX/if

Synopsis
\if   [\else ] \fi

Description
The \if command denotes the start of an if-then-else control structure. The forms  and  must expand to tokens.  and  can be either a character or a control sequence. If  and  both expand to the same character code then  is processed; otherwise it is ignored. If the \else section is included and  and  expand to different character codes, then  is processed; otherwise it is ignored.

A small LaTeX example
Here is a small LaTeX example, demonstrating the use of.

This example generates the output: undefed defed, 1 defed