<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It mostly helps to differentiate bindings from fields<div>Person( name : name )</div><div>Person( name == name )</div><div><br></div><div>This is generally more readable.</div><div><div>Person( $name : name )</div><div>Person( name == $name )</div></div><div><br></div><div>That said I prefer to only bind patterns, and if the class name does not conflict with any field names, then I don't use $</div><div>p : Person()</div><div>Person( name == p.name )</div><div><br></div><div>AI systems traditionally use ? to differentiate variables, but that symbol is not allowed as a variable name char in java.</div><div><br></div><div>Mark</div><div><div><div>On 15 Jan 2013, at 20:10, Michael Anstis <<a href="mailto:michael.anstis@gmail.com">michael.anstis@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">No difference, it was/is just used a lot in examples and advice given on here so has sort of become an unofficial standard.<br><br>Some argue the presence of "$" helps identify bindings when scanning DRL.<br><br>
<div class="gmail_quote">On 15 January 2013 20:04, suddeb <span dir="ltr"><<a href="mailto:sudipta.deb@gmail.com" target="_blank">sudipta.deb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
As I am very new to Drools, could you please tell me what is the difference<br>
between adding a $ at the beginning of a variable and without $.<br>
For example:<br>
rule "validate holiday"<br>
when<br>
*$h1 : Holiday( `when` == "july" )*<br>
then<br>
......<br>
end<br>
<br>
and<br>
<br>
rule "validate holiday"<br>
when<br>
*h1 : Holiday( `when` == "july" )*<br>
then<br>
......<br>
end<br>
<br>
Regards,<br>
Sudipta Deb<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Difference-between-adding-at-the-beginning-of-a-variable-tp4021549.html" target="_blank">http://drools.46999.n3.nabble.com/Difference-between-adding-at-the-beginning-of-a-variable-tp4021549.html</a><br>
Sent from the Drools: User forum mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote></div><br></div></body></html>