[Gambas-user] Better IIf?
Benoît Minisini
gambas at ...1...
Tue May 17 01:16:14 CEST 2011
> 2011/5/4 Jussi Lahtinen <jussi.lahtinen at ...626...>:
> > Hi!
> > I noticed this while debugging (from
> > http://gambasdoc.org/help/lang/iif?v3); "BE CAREFUL!
> > Contrary to IF, or the C/Perl ? operator, both TrueExpression and
> > FalseExpression are evaluated, whatever the value of Test is.
> > "
> >
> > This is pretty deceptive!
> > Can this be re-implement as syntactic sugar (compiler would turn IIf to
> > normal If/Else/Then structure)?
> >
> > Jussi
>
> +1
>
> If TrueExpression or/and FalseExpression are calls to methods, leads
> to a logical error because both methods are executed.
>
>
> Fabián Flores Vadell
>
IIf() is a function, not a trinary operator as in C or Perl. There is no
trinary operator in Gambas, and you won't see it before Gambas 4 at least!
Regards,
--
Benoît Minisini
More information about the User
mailing list