In this example a flow to count to a specific number.
npm run counter-example {howHigh=10000}This counter flow makes use of halt and matchUntilHalt. This example has four rules.
Bootstrap- This looks for a Number fact and a non existent Counter. Once this rule is fired a counter is asserted into the session.Done Counting- This rule looks for a Number and a counter that has a count equal to the Number. This rule is interesting because it callshalt()once it is fired which causesmatchUntilHaltto resolve.Log Count- This rule looks for a counter and logs a message every time the counter is divisible by 1000.Increment Counter- This rule increments the counter.