Dear all!
I have a single rule-file with several rules. In those rules I use local variables defined within the individual rules. I am not sure if those variables will interfere with each other when the rules are triggered simultaneously. It looks like this:
file: x.rules
rule “1”
when A
then
var Integer i = 0
[…]
i = 0
while ((i=i+1) <= 25) {
// do something with this integer
}
[…]
end
rule “2”
when B
then
var Integer i = 0
[…]
i = 0
while ((i=i+1) <= 10) {
// do something with this integer
}
[…]
end
rule “3”
when C
then
var Integer i = 0
[…]
i = 0
while ((i=i+1) <= 100) {
// do something with this integer
}
[…]
end
Conditions A,B,C may or may not trigger simultaneously and I wonder if the variable i from rule 2 may overwrite variable i from rule 1, if rules 2 is triggered before rule 1 finishes.
I guess they don’t interfere, because, after all, they should be local, but I ain’t 100% sure.
I think there is no need to call those Integers “i”, “j”, “k” in rules 1,2,3.
Is this correct?
thanks for your support,
Sulla