Internet PLC Forum

General => Technical support => Topic started by: ccdubs on April 30, 2012, 11:43:51 PM

Title: Logical Comparison Limit
Post by: ccdubs on April 30, 2012, 11:43:51 PM
Is there a limit to the number of logical comparisons that can be used in an IF statement?

E.g.,

IF A=1 OR B=1 OR .........Z=1 THEN
Title: Re:Logical Comparison Limit
Post by: garysdickinson on May 01, 2012, 11:28:07 AM
You can use very long statements in TBASIC.  I suspect that their may be a limit to the number of ASCII characters in a single line that TBASIC can handle.  If there is a maximum line length, I have not found it, yet.

As an example, this statement complies with TBASIC and appears to work:

IF A=B AND B=C AND c=d and d=e and e=f and f=g and g=h and h=i and i=j and j=k and k=l and l=m and m=n and n=o and o=p and p=q and q=r and r=s and s=t and t=v and v=w and w=x and x=y and y=z and A=B AND B=C AND c=d and d=e and e=f and f=g and g=h and h=i and i=j and j=k and k=l and l=m and m=n and n=o and o=p and p=q and q=r and r=s and s=t and t=v and v=w and w=x and x=y and y=z then DM[1]=1 else DM[1]= 0 endif
[/color]
Personally, I think that if you need to do this many logical operations in a single TBASIC statement, you might want to rethink your approach.  Code this complex is impossible to read, impossible to trouble shoot and impossible for the next guy to maintain.

Gary D.