Gambas3 Code Layout

Post

Posted
Rating:
#1 (In Topic #1170)
Regular
an_other is in the usergroup ‘Regular’
 How can I lay a long line of code out on two or more lines? I need to declare several long strings, which run off the right side of the page. I am sure I have seen a way to do this, but can't find it now I need it.
Many thanks for any advice, An.
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
vuott is in the usergroup ‘Regular’
 If you refer to alphanumeric character strings, you can break the string into two or more parts, enclosed by quotation marks.
For convenience you can also have each one followed by the "&" symbol.

Exemplum:
 Dim s as String
 s = "aaaa bbbb cccc ddd " &
       "eeee ffff gggg hhhh iiiiii"

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
You can just use multiple strings and they will be joined.

Code (gambas)

  1. s = "Some text, "
  2.     "Some more text"
  3.  
  4.  

Note, there is no linefeed between the strings and you CANNOT have a void line.
ie.

Code (gambas)

  1. s = "Some text, "
  2.  
  3.      "Some more text"
  4.  
  5. ' that will error because the blank line
  6.  
  7.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Have you got the line wrap option set off in the ide?

Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
an_other is in the usergroup ‘Regular’
Thanks for the suggestions, guys - Somehow I had the idea that the second line was preceded by something like a backslash, but of course I entirely missed the obvious - thanks again
Online now: No Back to the top
1 guest and 0 members have just viewed this.