Question: how to use if in latex?
Answer: Comparing two integers: \ifnum\value{num}>n {A} \else {B}\fi. This code executes A if num>n else B. ... 
If a number is odd: \ifodd\value{num} {A}\else {B}\fi. If num is odd then it executes A else B.
If with condition: \ifthenelse{condition}{A}{B} We have to load ifthen package to use this command.