code layout for easy reading - hint?

stocky

Senior Member
Hi all,

I have some long winded if then statements for example
Code:
if RUN_FLAG = 1 and RSTART_IN = 0 and LSTART_FLAG = 0 and ASTART_FLAG = 0 then RSTOP_SEQ
Does the editor support any method of breaking that up over multiple lines (like VB does)

for example (which BTW doesnt work..)
Code:
if RUN_FLAG = 1 
and RSTART_IN = 0 
and LSTART_FLAG = 0 
and ASTART_FLAG = 0 
then RSTOP_SEQ
Its just a PAIN to read like it is

Stocky
 

hippy

Technical Support
Staff member
There's no line continuation mechanism. You can turn the statement into nested IF's but the program memory used will likely go up ...

Code:
if RUN_FLAG = 1 then 
  if RSTART_IN = 0 then
    if LSTART_FLAG = 0 then
      if ASTART_FLAG = 0 then RSTOP_SEQ
    end if 
  end if
end if
 

stocky

Senior Member
Thanks Hippy,

Looks like I just have to put up with it as all those endif's will make it just as bad to follow! :)

Stocky
 

moxhamj

New Member
Long winded is ok. Just add comments if it is confusing, but that example looked pretty clear.

You could get really clever, and start storing values as bits in b0. In the example above, your binary value to match would be %00001000 and then you could check for a match with "if b0=%00001000 then...
 

stocky

Senior Member
I am using the bit method now - but as the number of bits/inputs/flags I am monitoring uses all the bits in b0-b3 Ii cant use "binary" method outlined easily.
 
Top