You can create the same effect using
   while(...)
   {}
or
   do
  {} while( ... );
or
   for(;;)
   {}

You can't do  it with switch(){} because that's not accepted at all.

-W

2012/1/6 Edson Tirelli <ed.tirelli@gmail.com>

   Looks like a bug. MVEL does ; injection in order to make ; optional, so my guess is that it is mistakenly injecting ; after your modify() call and handling {} as a separate code block.

   Edson


On Fri, Jan 6, 2012 at 11:51 AM, nickS <nsanders@msxi-euro.com> wrote:
Hi

I've been learning drools ands I saw that there is a Fibonacci example, so I
thought I'd write my own using mvel as the dialect and then compare it to
the model solution.

However, I couldn't get mine working. It parsed but the behaviour was very
odd. It kept ignoring the modify block in my recurse rule and consequently
it went into an infinite loop. I compared it to the 'approved' solution and
the two were pretty much the same, except that it worked and mine didn't.

After a lot of checking I noticed that I had started my curly brace on a new
line after modify but the example had continued straight after the closing
brace of the modify.

Works //

modify ( f ){
       value = 1
      };

or

 modify ( f ){value = 1 };


Doesn't Work //

modify ( f )
{
     value = 1
 };


Does anyone know if this is a bug or a feature?


--
View this message in context: http://drools.46999.n3.nabble.com/MVEL-curly-braces-position-bug-or-feature-tp3638341p3638341.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users