Question

I hope I'm not asking too many questions here. But this one is pretty simple I think. From this javascript site it says we can break up code to make it neater.

http://www.w3schools.com/js/js_statements.asp

But when I try it in Apps Script it says the "\" is an illegal character.

So basically I have a really long string and it makes my code look horrendous when it is allowed to go fully horizontal.

DocsList.getFolder('ABCDE' + someStringVariable + '/FGHIJKLMNOPQRSTUV' + someOtherStringVariable + 'WXYZ');

This would look better like this (IMHO):

DocsList.getFolder('ABCDE' + someStringVariable \
                         + '/FGHIJKLMNOPQRSTUV' \
                      + someOtherStringVariable \
                                        + 'WXYZ');

Anyways, that was my question.

Thanks in advance!

Was it helpful?

Solution

Just use the + sign to break across lines.

DocsList.getFolder('ABCDE' + someStringVariable +
                           '/FGHIJKLMNOPQRSTUV' +
                        someOtherStringVariable +
                                        'WXYZ');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top