ID:180125
 
If someone would be so kind as to post a quick example as how to format code so one line can appear on 2 or more lines. Basically, I need to take one LONG line of code and break it down so it's easy to read and I don't have to scroll far to the left to read it, and then scroll all the way right again to get back to my code. (I hope I explained that correctly!)

I KNOW I read how to do that in the Blue Book or in the Help somewhere - but after 2 days of searching, I just can't find it!

Any help would be appreciated.


- matt
plourde603 wrote:
If someone would be so kind as to post a quick example as how to format code so one line can appear on 2 or more lines. Basically, I need to take one LONG line of code and break it down so it's easy to read and I don't have to scroll far to the left to read it, and then scroll all the way right again to get back to my code. (I hope I explained that correctly!)

I KNOW I read how to do that in the Blue Book or in the Help somewhere - but after 2 days of searching, I just can't find it!

Any help would be appreciated.


- matt

use the \ character to escape the end of line character. For instance:

world << "This is one line \
wrapped over two lines."
plourde603 wrote:
If someone would be so kind as to post a quick example as how to format code so one line can appear on 2 or more lines. Basically, I need to take one LONG line of code and break it down so it's easy to read and I don't have to scroll far to the left to read it, and then scroll all the way right again to get back to my code. (I hope I explained that correctly!)

You can use the \ character to extend a line, eg:

mob
var/test = \
"some really really really \
long string"

Since most of the time this kind of thing is done with text, you can alternatively use the little-known "text document" feature:

mob
var/test = {"
some really really really
long string
"}
plourde603 wrote:
If someone would be so kind as to post a quick example as how to format code so one line can appear on 2 or more lines. Basically, I need to take one LONG line of code and break it down so it's easy to read and I don't have to scroll far to the left to read it, and then scroll all the way right again to get back to my code. (I hope I explained that correctly!)

It's the \, used like this:

this is a \
very long line
In response to Shadowdarke
Aha! I knew it was something easy! Thanks guys!


- matt