Thanks Maurice for your answer
The difference for me is that you need 4 line of code and two global variable where I use only one line per valve with only one local variable…
What if I have 15 valves to manage like this?
My idea was to duplicate and adapt line like the line 110 or 120 fir each valve.
I agree with you for goto but I would make a difference for gosub…
I need the gosub only because there is no way to fix the cycling time of a PRG block , this would be a interesting option to define…
All basic real time PLC work like this .
Sedona has the same philosophy . You can define if a sub program is executed at each cycle or every x cycle.
You also did not answer my question, is control basic able to evaluate a Boolean logic function?
I always prefer that an output or a variable is written only one time with a Boolean equation rather than use of set / reset in different places that makes the program messy to understand and validate especially when there are no line by line debugging program tools,
The only case where I use multiple writing of the same variable is when this variable is a PN integer number corresponding to the step number of a state machine like SFC chart without parallel branch.
Then I use some logic and the end of the state machine to link the output to the state variable by comparison equation .
Like this I am sure that the logic is not depending of some disturbance that could occur and I can force the state machine in any step and having the output reflects the state I want.
I understand that for this case it is not critical, I just wanted to explain where does come from my habits to write output with comparison rather than with set/ reset or timer management .