Bill Allombert on Sun, 19 Jul 2020 23:24:28 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Feature suggestion: "ifcmp" convenience control statement


On Sun, Jul 19, 2020 at 04:00:23PM -0500, Hans L wrote:
> When writing functions in gp, I think it is fairly common to need to
> do 3 different things depending on a comparison of two values.
> This can of course be done with nested if() but it feels verbose and
> can get messy depending on how complicated the terms are:
> if(a<b, do_lt(), if(a>b, do_gt(), do_eq() ))

You can do
if(a<b, do_lt(), a>b, do_gt(), do_eq())

Cheers,
Bill.