How to put a line break in between strings? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jono_Moore

Make sure you are using \n and not /n.

10 replies

Jono_Moore
Level 10
April 2, 2012

"\n" is a return in JS.

So if you add a couple at the beginning of your strMessage3 text it should do the trick: "\n\n**THE DCO REQUEST..."

April 2, 2012

Nope, that doesn't work.  It only prints the "/n/n" as text before the message.  Putting it outside just before the quotes does not work either, that disables the button function completely.

Jono_Moore
Jono_MooreAccepted solution
Level 10
April 2, 2012

Make sure you are using \n and not /n.

April 2, 2012

Oops, make sense.  It works now, thanks!

Geckoz100
Level 5
April 16, 2015

I'm using these "\n" in several scripts that have multiple lines, so I'm using the "+" at the end of the line to continue.  When I use a single "\n" the "+" becomes inactive, but when I use "\n\n" it works again.  Do you know what this is about?

This works:

"bla bla \n\n" +

This doesn't work:

"bla bla \n" +

Geckoz100
Level 5
April 22, 2015

Can anyone shed any light on this?  Thanks.

Level 7
April 28, 2015

both work fine for me.

I had to add "bla bla \n\n" + "bla" or "bla bla \n" + "bla" If you have the + after but do not follow it with something then it does not work.

Geckoz100
Level 5
April 28, 2015

When I put just one ".... \n" at the end of a line, the "+" goes inactive (not blue), like it's not working.  What am I doing wrong?

Level 7
April 28, 2015

You are correct the + sign does turn black after a single return \n but blue after a double \n\n but both work for me. It could be a bug in LCD. To be honest I did not even notice the color change until I changed the font size of my script window.

Geckoz100
Level 5
April 29, 2015

You were right!  I assumed because the color was not correct that the syntax was bad, so I never actually tried leaving it that way.  As you say, it does work.

Thanks.