[Gambas-user] break long lines

Stephen Bungay sbungay at ...981...
Thu Jul 23 19:05:44 CEST 2009


Benoît Minisini wrote:
>>    For String assignments you can put an & at the end of it...
>>
>> String = "ABCD " &
>>           "1234"
>>
>> Steve.
>>
>> Jean-Yves F. Barbier wrote:
>>> Hi,
>>>
>>> Is there a special character (such as \ under bash) to break a very long
>>> line?
>>>
>>> JY
> 
> There are two ways of spanning a long line on several ones:
> 
> - Once a binary operator is read, its second operand can start on another 
> line.
> 
> This is Jean-Yves' example.
> 
> - A string can be written in several parts with new lines between.
> 
> String = "This " "is " "actually "
>          "only " "one " "string " "in " "the " "compiled " "code!"
> 
> Regards,
> 

   A caveat when not using the ampersand to span long lines at least 
when building strings.. for example this;

SQLString = "SELECT * "
             "FROM Table1 "
             "WHERE Field1 LIKE " & TextBox1.Text & ";"

   Will generate an "Unexpected &" error, whereas this

SQLString = "SELECT * " &
             "FROM Table1 " &
             "WHERE Field1 LIKE " & TextBox1.Text & ";"

   will not.


Regards
Steve.




More information about the User mailing list