1. Lawrence Anderson
  2. PowerBuilder
  3. Thursday, 23 January 2020 17:14 PM UTC

If I have an if statement that is long and I want to continue it to another line, what is the format? The typical & (carriage return) + format is being flagged as a syntax error. 

 

Accepted Answer
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 17:20 PM UTC
  2. PowerBuilder
  3. # Permalink

This works

if 'abc' = 'bcd' or &
    'cde' = 'cde' then
    // Code here
end if

Comment
  1. Roland Smith
  2. Thursday, 23 January 2020 18:51 PM UTC
Assignment continuation:



ls_string = "blah blah blah" + &

"some more stuff"
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 24 January 2020 06:21 AM UTC
Sorry Ronald, not trying to be "smart" but to avoid confusion, do you mean assignment "concatenation"?
  1. Helpful
  1. Michael Kramer
  2. Friday, 24 January 2020 12:43 PM UTC
Ronald = Roland? ;-)

The ampersand character initiates statement *continuation* across "immediately following" line break.

And it is true that in Roland's case the continuation happens in the middle of a string *concatenation*.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Thursday, 23 January 2020 18:19 PM UTC
  2. PowerBuilder
  3. # 1

Agree with David, as soon as you introduce &-continuation in an IF-THEN you should prefer the long variant IF-THEN + END-IF. Look at END-IF as PowerScript's "curly braces" variant.

If you post your invalid syntax I'd be happy to look for why it fails.

/Michael

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.