[Gambas-user] no IF ... THEN ... ELSE ... in one line?
Rolf-Werner Eilert
eilert-sprachen at ...221...
Wed Oct 10 12:12:12 CEST 2012
As you might guess, I managed to re-write the things with IIF like
mesVon.Add(IIF(teil.Count > 1, teil[1], ""))
which is even shorter than the one-liner I wanted to use first.
My only worry is speed - is IIF much slower than a pure IF ELSE
construction?
Rolf
Am 10.10.2012 10:46, schrieb Rolf-Werner Eilert:
> Hi,
>
> just stumbled over this one:
>
> IF teil.Count> 1 THEN mesVon.Add(teil[1]) ELSE mesVon.Add("")
> IF teil.Count> 2 THEN mesStatus.Add(teil[2]) ELSE mesStatus.Add("")
> IF teil.count> 3 THEN mesPri.Add(teil[3]) ELSE mesPri.Add("")
> IF teil.Count> 4 THEN mesRef.Add(teil[4]) ELSE mesRef.Add("")
> IF teil.Count> 5 THEN mesText.Add(teil[5]) ELSE
> mesText.Add("Fehler: Defekte Message-Datei")
>
> Doesn't seem to be possible in Gambas, so I would have to write
>
> IF teil.Count> 1 THEN
> mesVon.Add(teil[1])
> ELSE
> mesVon.Add("")
> END IF
>
> for all of the above cases - a bit roundabout and not so well readable,
> isn't it?
>
> Regards
>
> Rolf
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list