logo       

Re: [drools-user] Doubts in Bound Variables: msg#00149

java.drools.user

Subject: Re: [drools-user] Doubts in Bound Variables

Niyas,

There is no difference I can see between the 2 rules. Only thing worth to mention is you can't have both simultaneously in your package because they have the same name, but I guess you have one or the other, right?

Regarding the $, as Oana said, it is just a naming convention. We use it to make clear a variable is a rule bound variable. As you know, "$" is a valid java starting character for identifiers, so you can use a java variable named "$cust", the same way you can use another named "cust".

[]s
Edson

Niyas wrote:

Why in the second case it's not printing anything? I am not asked
about usom valid identifiers.... pls see the below two rules..

Is there any difference between the below two rules

rule "Credti Accept" salience 10
when
cust:Customer(customerAge > 18) then
System.out.println("Credit Card Allowed For :: " +cust.getCustomerName());
//retract(cust);
end




rule "Credti Accept" salience 10
when
$cust:Customer(customerAge > 18) then
System.out.println("Credit Card Allowed For :: " +$cust.getCustomerName());
//retract(cust);
end

On 12/21/06, nicolae oana <oananicolae1981@xxxxxxxxx> wrote:

Hi Niyas,

There is no difference between your two declarations emp and $emp . The sign
'$' is used as first letter in the name of a declaration just to
differentiate declarations from fields. You can used or not. It's your
choice. But I think it is appropriate to use it, just to follow the drools
standards in writing the code.

Best regards,
Oana.

Niyas <niyasahmed@xxxxxxxxx> wrote: I am new to jBoss Rule - Drools and I am
hust going thru' the manual
and trying some examples using JBoss Rules IDE in Eclipse..

I am having doubt in bound variable:

what is the difference between emp: Employee and $emp:Employee (the $
sign)? give some example

---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com



---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise