Author Topic: cust fun line continuation  (Read 12972 times)

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
cust fun line continuation
« on: October 08, 2007, 01:52:26 PM »
Is there a way to continue a long line in a custom function, or print it, where the end isn't printed, or wrapped to next line?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:cust fun line continuation
« Reply #1 on: October 08, 2007, 04:24:36 PM »
can you cite an example of a long line? Most statements are short and if you have multiple conditions you can just split them up into two  or more  lines:

E.g.
IF TESTIO(LABEL1) AND TESTIO(LABEL2)
              AND TESTIO(LABEL3)
              AND TESTIO(LABEL4)
   A = 1
ELSE
   A = 2
ENDIF


The effect is the same as:

IF TESTIO(LABEL1) AND TESTIO(LABEL2)  AND TESTIO(LABEL3) AND TESTIO(LABEL4)
    A = 1
ELSE
   A = 2
ENDIF
« Last Edit: October 08, 2007, 06:13:49 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Re:cust fun line continuation
« Reply #2 on: October 08, 2007, 06:11:18 PM »
Here's the statement, I think your answer solved my problem, I'll just add a new line and tab before an AND where needed to break up the line. Thanks for the quick reply. :)


IF (DATE[3] > (7 * (DM[3975] - 1 )) AND (DATE[3] < (7 * DM[3975]) + 1) AND (DATE[4] = DM[3976]) AND (TIME[1] = DM[3977]) AND (TIME[2] = 0) AND (TIME[3] >= 0))

And here's the new:

IF (DATE[3] > (7 * (DM[3975] - 1 ))
     AND (DATE[3] < (7 * DM[3975]) + 1)
     AND (DATE[4] = DM[3976])
     AND (TIME[1] = DM[3977]) AND (TIME[2] = 0)
     AND (TIME[3] >= 0))