# Question:when to use `if` vs. normal if?

## Question:when to use `if` vs. normal if?

I am newbie in Maple, and trying to understand when to use operator `if` as I see in some code vs. normal if. This is in context if using map()

I noticed I can write

A:=[seq(i,i=1..10)];
f:=x->x^2;
map(x->`if`(x<5,f(x),NULL),A);

or

map(x->if x<5 then f(x) fi,A);

And they both work the same. When should one use `if` vs. if? with the case of `if` I had to give a third argument NULL for the else part, while with using direct "if", I did not have to give the "else" part.

Also, suppose I want to use  IF .. THEN .. ELIF ... FI, then how would this be done using the operator syntax? in normal "if", I can write

A:=[seq(i,i=1..10)];
f:=x->x^2;
map(x->if x<5 then f(x) elif x=5 then x else x-1 fi,A);

Actually if I understand better when `if` is meant to be used vs. where the normal "if", I might understand more its use.

ps. I did look at the help here but did not see it recommend when to use over the other (unless I overlooked it)

﻿