As mentioned in the comments the TeXBook is the ultimate reference for these things. But also it is worth mentioning the terminology which may help when searching for free documentation on this site or elsewhere.
The conditionals themselves \if
\ifnum
and friends are TeX primitives rather than defined in plain TeX. TeX itself does not provide boolean operators such as OR and AND although of course various macro packages implement these (by suitable nesting of the primitive if constructs) but plain TeX does not in fact define any such macros. So a literal reading (but not so helpful) reading of your question would lead to the answer that there is no documentation as plain TeX does not have AND or OR. (there is an \or
primitive that is used with \ifcase
but that is not the infix connector implied by your question).
Your first example:
IF #1 >= 1 AND #2 >= 10
\ifnum#1>1
\ifnum#2>9
yes
\else
no
\fi
\else
no
\fi
Your second example, here you would have to be more specific
IF #1 != “tree” OR #2 == “mountain”
does #1
have to be given as {tree}
or does \def\x{tree}..... {\x}
count as true, and if so do you just want to allow one level of expansion or an arbitrary number. The testing is rather different in each case.
But perhaps
\def\treetest{tree}\def\mountaintest{mountain}
\def\testa{#1}\def\testb{#2}
\ifx\treetest\testa
\ifx\mountaintest\testb
yes
\else
no
\fi
\else
yes
\fi
This one is the same as the first, really.
IF 10 > #1 > 2
\if
is not used in the way you seem to be suggesting in your psuedo-code. So we could do with a bit more information on what you do know/have tried.etoolbox
, the LaTeX3 project, etc.), but will need quite a lot of detail. It may also obscure how the primitives work, at least to some extent.if 10 > #1 and #1 > 2
and you need to use lowercaseand
,or
, andif
).