\ifthenelse{⟨test⟩}{⟨then clause⟩}{⟨else clause⟩} evaluates ⟨test⟩ as a boolean function, and then executes either ⟨then clause⟩ or ⟨else clause⟩. ⟨test⟩ is a boolean expression using the infix connectives, \and, \or, the unary \not and parentheses ( ).
The command \ifthenelse is invoked within of the package ifthen: https://www.ctan.org/pkg/ifthen. In fact the package's basic command is \ifthenelse, which can use a wide array of tests. Also provided is a simple loop command \whiledo.