# \if@ statement explanation

I'm trying to tweak some .cls to fit my needs, and I'd really appreciate it if someone could explain me these statements:

...
\else
...
\fi

If I understand correctly, it will match @radseminartrue, right? How can I use OR statement? For example, I tried

but it didn't match either.

-
Answers to this question might be helpful. tex.stackexchange.com/q/5894/215 – Seamus Jan 7 '11 at 17:12
Note that \if@radseminar is one control sequence. Moreover, an "OR" construct of the sort you're seeking doesn't exist. – Hendrik Vogt Jan 7 '11 at 17:18

There is no macro \if@ … the macro you’re seeing is called \if@radseminar (yes, the @ and all that follows is part of the macro name).

TeX doesn’t know boolean evaluation. You cannot just join several conditions together like in other programming languages. You need to test the conditions separately by nesting them:

<true>
\else
<true>
\fi
<else>
\fi

However, there are LaTeX packages to allow this, e.g. etoolbox or ifthen (the latter shouldn’t be used any more I’ve been told).

Using etoolbox, it should look approximately like this:

-
thanks! :) being a programmer, I'm having problems adjusting to latex :D – Marin Jan 7 '11 at 17:42
What's wrong with ifthen? – Matthew Leingang Jan 8 '11 at 12:21
@Matthew: to be honest, I don’t know. Philipp called it obsolete in a comment to another answer. I guess it’s simply superseded by the more feature-rich and slightly better designed etoolbox. However, I’ve found at least one case where ifthen has yielded a different (and IMHO correct) result than etoolbox. – Konrad Rudolph Jan 8 '11 at 14:42

As others pointed out the \if@ is not a macro just part of a macro name. Using higher-level macros like the ones of the already mentioned etoolbox package should be preferred for beginners and/or for documents.

The common method to OR-combine multiple if-switches using lower level macros is to use \ifcase. It awaits a number (0 or higher) and then executes only the corresponding branch. The branches are separated by \or. The last one can be separated by \else which is executed if there is no explicit branch for that number.

\ifcase0%