commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trevor Harrison" <trevorsharri...@gmail.com>
Subject JEXL multi-statements in expression
Date Wed, 03 Oct 2007 19:38:39 GMT
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?

-Trevor

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


Mime
View raw message