Jump to content
OMRON Forums

Recommended Posts

Posted
In a script PLC, how can we have a IF statement with conditions on multiple lines. As a very simple example for testing purpose, I tried following things without any success: IF(M2000 == 1 && M2100 == 1) IF(M2000 == 1 && M2100 == 1) IF((M2000 == 1 && M2100 == 1)) IF((M2000 == 1 && M2100 == 1)) When very very long conditions, we need multiple lines.
  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Posted
[quote=DT-Europe] In a script PLC, how can we have a IF statement with conditions on multiple lines. As a very simple example for testing purpose, I tried following things without any success: IF(M2000 == 1 && M2100 == 1) IF(M2000 == 1 && M2100 == 1) IF((M2000 == 1 && M2100 == 1)) IF((M2000 == 1 && M2100 == 1)) When very very long conditions, we need multiple lines. [/quote] We will look into this and see what can be done. Look for more information in awhile.
  • 6 years later...
Posted
[quote='bradp' pid='80' dateline='1226700531'] [quote=DT-Europe] In a script PLC, how can we have a IF statement with conditions on multiple lines. As a very simple example for testing purpose, I tried following things without any success: IF(M2000 == 1 && M2100 == 1) IF(M2000 == 1 && M2100 == 1) IF((M2000 == 1 && M2100 == 1)) IF((M2000 == 1 && M2100 == 1)) When very very long conditions, we need multiple lines. [/quote] We will look into this and see what can be done. Look for more information in awhile. [/quote] Has this been fixed yet? Hard to believe in 2015, that you can't break complex conditional statements into multiple lines.
Posted
This is not something to fix as this is the C-like standard for logic structures. It was our intent to make the script language in Power PMAC to be as much as possible C-like in its syntactical contructs.
Posted
I'm not sure I understand, I thought standard C ignored whitespace. IF ((M1 == 0) && (M2==0)) is supposed to be identical to: IF ((M1 == 0) && (M2 == 0) ) and is identical to: IF ((M1 == 0) && (M2 == 0)) This is not the case in Power PMAC script (although it was in Turbo!). If this is never going to be "fixed", then is there at least some type of line continuation characters that we can use to break up extremely long lines?
Posted
[quote='ScottB' pid='8130' dateline='1437565026'] I'm not sure I understand, I thought standard C ignored whitespace. IF ((M1 == 0) && (M2==0)) is supposed to be identical to: IF ((M1 == 0) && (M2 == 0) ) and is identical to: IF ((M1 == 0) && (M2 == 0)) This is not the case in Power PMAC script (although it was in Turbo!). If this is never going to be "fixed", then is there at least some type of line continuation characters that we can use to break up extremely long lines? [/quote] I use the '\' on occasion in script for line continuation and it seems to work fine.
Posted
[quote='wehg' pid='8149' dateline='1437663862'] I use the '\' on occasion in script for line continuation and it seems to work fine. [/quote] I wasn't aware of that, thanks. That helps break up long lines although the text editor in the IDE doesn't like it, it marks the lines with the red squiggly underline.
Posted
The "\" character is not recognized as a line continuation signal by the script downloader. It is only used by the C compiler. There are probably many placements in a script file where it will not cause an error (treated as a CS on-line feedhold in the ASCII stream to PMAC), but the following will cause an error: if (P1==1 \ && P2==2)
Guest
This topic is now closed to further replies.

×
×
  • Create New...