[slang-users] slang 2.2.3 released
Jörg Sommer
joerg at alea.gnuu.de
Sun Dec 19 12:48:29 UTC 2010
"John E. Davis" <davis at space.mit.edu> wrote:
> Interpreter Enhancements
> ========================
>
> 1. The ternary expression was added:
>
> expression = condition ? val1 : val2
>
> If condition is non-zero, then expression = val1,
> otherwise expression = val2
Does it support the Syntax:
expression = condition ? : val2
which should be the same as
tmp = condition
if (condition != 0)
expression = condition;
else
expression = val2;
This is handy for non‐simple expression as condition.
return sql_query("select * from table") ? : sql_query("select * from
table2");
> 2. The break and condition statements support an optional integer
> that indicates how many loop levels the statement affects, e.g.,
> the break statement in
>
> while (1)
> {
> loop (10)
> {
> break 2;
> }
> }
>
> will cause both loops to be terminated.
This is very useful! Thanks.
Bye, Jörg.
--
And 1.1.81 is officially BugFree(tm), so if you receive any bug-reports
on it, you know they are just evil lies.
(Linus Torvalds)
More information about the slang-users-l
mailing list