I have an if statement with multiple conditions. I cannot see them all in a single window view. Is there a way to separate them on different lines or do they ha
Like the above, you can break up the long set of conditions in one "IF" statement by using an underscore.
If there are too many conditions and I find it challenging to read, I use BOOLEANS to represent the conditions. It seems like there is more code, but I find it easier to read.
If I have a scenario where I need to do the following:
IF (X = something1) OR (X = something2) OR (X = something2) OR (X = something2) OR (X = something2) OR (X = something2) OR (X = something2) OR (X = something2) THEN
END IF
I could do this:
IF _
(X = something1) _
OR (X = something2) _
OR (X = something3) _
OR (X = something4) _
OR (X = something5) _
OR (X = something6) _
OR (X = something7) _
OR (X = something8) _
THEN
END IF
... or I could do this ...
blnCondition1 = (X = something1)
blnCondition2 = (X = something2)
blnCondition3 = (X = something3)
blnCondition4 = (X = something4)
blnCondition5 = (X = something5)
blnCondition6 = (X = something6)
blnCondition7 = (X = something7)
blnCondition8 = (X = something8)
IF blnCondition1 OR blnCondition2 OR blnCondition3 OR blnCondition4 OR blnCondition5 OR blnCondition6 OR blnCondition7 OR blnCondition8 THEN
END IF
Of course, the example BOOLEAN variables are defined, and instead of names like blnCondition1, I'll use meaningful names.
Again, it's just a preference I have.