[fpc-pascal] New feature: IfThen() intrinsic

Dennis dec12 at avidsoft.com.hk
Tue Feb 2 03:03:37 CET 2016



Roberto P. wrote:
> Maybe we shouldn't focus all that much on the " if " word..since all 
> in all, it is meant to be differently from the language if-then-else
> What about using another word suggesting a choice?
>
>    j := Switch(i < 32, 48, 21);
>    j := Select(i < 32, 48, 21);
>    j := Which(i < 32, 48, 21);
>
> They look to me as a goog compromise between expressiveness (IfThen) 
> and typing-laziness (iif).
>
> Roberto
>
Switch, Select, Which
are all good except that they are very common English words. They might 
already be used by users in existing function names in their code.

I prefer

V := If Condition then ThenExpr else ElseExpr;

Beginners to Free Pascal can easily guess its meaning just by its look.

Dennis



More information about the fpc-pascal mailing list