Welcome Guest

Pages: 1
AND/OR logic
UKenGBPostApril 12, 2021, 06:53
Advanced
Posts: 57
Registered:
April 30, 2020, 09:36
Normal topicAND/OR logic

I understand how to use individual tests and multiples that all return the same state (just use AND or OR in subsequent tests, but I am not clear about more complex variations on this. I want to construct something like this:-

if
a is true
and b is true
or c is true
then…

In order to get this working correctly, it is necessary to know the order of priority for the AND and the OR parts. Do ANDs have priority and then the OR is tested, or the other way around? Or indeed are they taken in strict order of the declaration?

UKenGBPostApril 12, 2021, 07:02
Advanced
Posts: 57
Registered:
April 30, 2020, 09:36
Normal topicAND/OR logic

Thinking more about this, I'd be fairly sure it works in order of declaration since I don't think Yate does any 'look ahead' processing of action statements, so it will simply perform each test and set the state according to it being an SET, AND or and OR. Then it will compare that state with the next test and set the state accordingly and on to compare with next test etc. So all in strict order.

Would that be correct?

2MR2PostApril 12, 2021, 09:11
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicAND/OR logic

Correct there is no 'look ahead'. Every statement proceeds to the next. The fact that it may modify the test state is not an exception.

The most common errors are: Starting a test sequence with an AND or OR; and inserting a Set where they should be using an AND or OR.

Some statements are smart enough to skip the testing entirely when using AND or OR but that is what you'd expect.

If you have anything complicated enough that you need out of order precedence, the test state can be copied to a variable and used in a subsequent test.

UKenGBPostApril 12, 2021, 10:46
Advanced
Posts: 57
Registered:
April 30, 2020, 09:36
Normal topicAND/OR logic

As I thought then. Thanks.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.026 seconds.