CoDeSyS and Condition evaluation

yanapa
2009-12-07
2009-12-10
  • yanapa - 2009-12-07

    Hi, I'm asking something about condition evaluation. Check the following code:

    var_a := FALSE;
    var_b := FALSE;
    if var_a and var_b then
    begin
    ;//Some code
    end;
    

    In this case, did the program will check the var_b or it will bypass directly after checking the var_a value ?

     
  • spfeif - 2009-12-09

    If (condition) then

    logic

    end_if

    Your condition is an AND statement which must take two operators A and B. B is never skipped.

     
  • shooter - 2009-12-09

    the example is not correct but the question is.

    when it is an OR does it stop testing the rest?

    probably not.

     
  • spfeif - 2009-12-10

    Oh, now I understand. The question is since it was an AND condition and the first vlaue is false that means why even evaluate the second. Missed that one.

     

Log in to post a comment.