[Gambas-user] no IF ... THEN ... ELSE ... in one line?

Benoît Minisini gambas at ...1...
Sun Oct 14 00:44:19 CEST 2012


Le 10/10/2012 10:46, Rolf-Werner Eilert a écrit :
> 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
>

I added support for IF ... THEN ... ELSE ... on one line in revision #5236.

Regards,

-- 
Benoît Minisini




More information about the User mailing list