cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Breaking Long Code Lines

Anonymous
Not applicable
How do you break a single long line of code into several shorter lines? In Visual Basic you can put an underscore character at the end of one line to tell VB that the statement is continued on the next line. Any equivalent in GDL?
7 REPLIES 7
Anonymous
Not applicable
It depends on what is making your line long. You can always put a return (line feed) after a comma. I don't think you can break up a formula (i.e. return after a `+` or such). You might be able to return after `&` and `OR` conditions. I don't recall if I've tried this or not but I think the comma is the only line continuation character.

The short answer is to add a return/line feed and see if an error results.
Anonymous
Not applicable
Also (I guess you allready know this, but...) the colon ":" symbol is meant to combine 2 lines into 1, so replace it with a return.

I doubt that's the problem, but you never know.
Anonymous
Not applicable
It's a mathematical equation. Neither the comma nor the colon work. Oh well.
Anonymous
Not applicable
Try splitting the statement like so:
x = 5 + 20
x = x + 25
And so x becomes 50. It's an option
Daniel Lindahl
Contributor
Jay wrote:
How do you break a single long line of code into several shorter lines? ....
Jay

From the GDL manual, Chapter 2, section on character strings:

\new line continue string in next line without a new line

I don't know if this works - have never tried it.
cheers
Daniel
-------------------------------------
Daniel Lindahl Architecture
AC24 | Dell Inspiron 16+ | Windows 11
Anonymous
Not applicable
Daniel ,
I have some code with some very long "if....then" statements
with lots of "and"s and "or"s that had to be on one line or I
would get error messages if I tried to use commas but
I just tried your suggestion of using the backward slash character
"\" new line to break up the statement into several lines
and I get no error messags.
Thanks for the tip.
Peter Devlin
Anonymous
Not applicable
I tried the backslash in the middle of a very long mathematical statement and it worked just fine.