commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
Subject Re: JEXL multi-statements in expression
Date Wed, 03 Oct 2007 19:47:08 GMT
On 10/3/07, Trevor Harrison <trevorsharrison@gmail.com> wrote:
> I'm brand new to JEXL, and ran into something a little strange that
> took me quite a while to wrap my head around.
>
> I was playing around with different expressions to see what was valid,
> and ran into a problem with this:
>
> i = 0; while ( i < 10 ) i = i + 1;
>
> which only executes the i = 0; and then returns without evaluating
> anything else.
>
> I was a little confused, because I was expecting behavior similar to
> the block { } feature.
>
> So, I tried
> { i = 0; while ( i < 10 ) i = i + 1 }
>
> which didn't compile.
>
> However, this does:
>
> if ( true ) { i = 0; while ( i < 10 ) i = i + 1; }
>
> which seems to work just fine.  Just a little strange that there isn't
> an implicit block around the entire expression.
>
> Is there a better way to do this?
>
<snip/>

Use the ScriptFactory [1] instead.

-Rahul

[1] http://commons.apache.org/jexl/apidocs-1.1/org/apache/commons/jexl/package-summary.html


> -Trevor
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message