slang-users mailing list

[2010 Date Index] [2010 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] slang 2.2.3 released


"John E. Davis" <davis@xxxxxxxxxxxxx> 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)
_______________________________________________
slang-users-l mailing list
slang-users-l@xxxxxxxxxxx
http://mailman.jedsoft.org/mailman/listinfo/slang-users-l

[2010 date index] [2010 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]