If Statement Not Comparing Properly
As stated, i'm sure this is a simple mistake starting me in the face, but I'm having trouble figuring out why my variable newState, when explicitly set to the string 'F1', does not
Solution 1:
If newstate
is F1, it will not trigger the else, because newState != 'F2'
will trigger.
In the first if, try making it
if (not(newState == 'F1' or newState == 'F2' or newState == 'F3' or newState == 'error')):
The problem is
if !A or !B or ...
is not the same as
if !(A or B or...)
which is equal to
if (!A and !B and ...)
By DeMorgans law.
Post a Comment for "If Statement Not Comparing Properly"