Observe:<br><br>rule &quot;Bill Status&quot;<br>salience 100<br>when<br>    p :- exists Bill( paid == true )<br>then <br>    System.out.println( &quot;There are &quot; + (p ? &quot;some&quot; : &quot;no&quot;) + &quot; paid bills.&quot; );<br>
end<br><br>rule &quot;Pay Bills&quot;<br>when<br>    $bill: Bill( paid == false )<br>then<br>    System.out.println( &quot;Paying &quot; + $bill.getAmount() );<br>    modify( $bill ){ setPaid( true ) }<br>end<br><br>There are three unpaid Bills inserted, then fireAllRules():<br>
There are no paid bills.<br>Paying 3000<br>There are some paid bills.<br>Paying 2000<br>Paying 1000<br><br>-W<br>