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:
- function max(a,b) =
- if(a> b)
- a
- else
- b;
You can also use the 'traditional' {cond} ? {expr} : {expr} syntax but it won't be as easy to read.
Loop expressions
Prexonite Script:
- function main()
- {
- var xs = for(i = 0; i <100; i++)
- yield i;
- ;
- var ys = foreach(var x in xs)
- yield 2*x;
- ;
- }
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 »