How to quickly write “if” in mathmode

Probably asked before but these type of search queries are not very google friendly.

In mathmode, you can type \cos to quickly get the cosine, in normal typeset. Can you do something similar for "if"? Preferably a single command rather than \text{if}.

 Bonus: get some spacing after the if, ie. I am looking for the best way to write "if n = 1" after one case of an equation.

• Isn't that what macros are for? \newcommand\Mif{\text{if}~}, for example. – Steven B. Segletes May 4 '16 at 15:32

There's no such command, but you can create one. As you've probably already noticed, $if$ isn't right: the font and spacing represent i times f, not the word if. $\mathrm{if}$ or the like isn't right either; depending on the choice of fonts, this may or may not look similar to \text{if}. \text{if} is the way to go, either directly or via another command.
\newcommand{\ifm}[1]{\text{if $#1$}}
$n! = n (n-1)! \quad \ifm{n \ge 1}$