[rules-users] Boolean logic fail?

Mark Proctor mproctor at codehaus.org
Sat Jun 5 02:01:52 EDT 2010


'or' is a conditional element to be used between patterns. '||' is an 
infix operator to be used in field constraints inside of patterns.

Mark
On 05/06/2010 00:23, Matthew Runo wrote:
> Hello folks -
>
> We noticed something weird today, and was hopeing that someone here might be able to explain it for us a bit.. Here's the rule we had:
>
> eval( -1<  0 or
> 8>  1 or
> 182<  0 or
> 0 == 0);
>
> This was failing, but doesn't it seem like it should work? To get it to work, we tried this:
>
> eval( (-1<  0) or
> (8>  1) or
> (182<  0) or
> (0 == 0));
>
> ... but that didn't compile. We then tried this (and it worked!):
>
> eval( (-1<  0) ||
> (8>  1) ||
> (182<  0) ||
> (0 == 0));
>
> So, my question is simply - why? What's the difference between "or" and || - and when should we use them?
>
> Thanks for your time!
>
> Matthew Runo
> Software Engineer, Zappos.com
> mruno at zappos.com - 702-943-7833
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>    





More information about the rules-users mailing list