Observe:<br><br>rule "Bill Status"<br>salience 100<br>when<br> p :- exists Bill( paid == true )<br>then <br> System.out.println( "There are " + (p ? "some" : "no") + " paid bills." );<br>
end<br><br>rule "Pay Bills"<br>when<br> $bill: Bill( paid == false )<br>then<br> System.out.println( "Paying " + $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>