New features in the 4th beta preview

Hey, it's been a while but I have added a number of neat features to Prexonite and especially to Prexonite Script.

Conditional expressions

Prexonite Script:
  1. function max(a,b) =
  2.     if(a> b)
  3.         a
  4.     else
  5.         b;

You can also use the 'traditional' {cond} ? {expr} : {expr} syntax but it won't be as easy to read.

Loop expressions

Prexonite Script:
  1. function main()
  2. {
  3.     var xs = for(i = 0; i <100; i++)
  4.                 yield i;
  5.     ;
  6.     var ys = foreach(var x in xs)
  7.                 if(x mod 2 == 0)
  8.                     yield 2*x;
  9.     ;
  10. }

Loops can be used as expressions. Their 'value' is a list of all values 'returned' via the yield keyword. Although it may look like a coroutine, in reality a Prexonite list is returned and not a coroutine reference. More »