How to create a new line (return) in live code

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
TrevorDowdle
Posts: 16
Joined: Tue Jul 10, 2012 4:37 pm

How to create a new line (return) in live code

Post by TrevorDowdle » Thu Jul 12, 2012 4:13 pm

Hey,

Lets say I am trying to get the following string -

"Hello
World"

I don't know how to make it so that there is a new line between Hello and World
This is currently how my code looks.

Code: Select all

put "Hello" &\
   "World" into myString
"HelloWorld"

How can I make a new line in live code?

Thanks

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: How to create a new line (return) in live code

Post by sturgis » Thu Jul 12, 2012 4:21 pm

look in the dictionary for:

cr (synonym is return)
crlf
lf

to do what you want would be something like this

Code: Select all

put "Hello" & cr & "world" into myVariable
Good beginner resources:
http://lessons.runrev.com/
http://www.runrev.com/developers/lesson ... nferences/

TrevorDowdle
Posts: 16
Joined: Tue Jul 10, 2012 4:37 pm

Re: How to create a new line (return) in live code

Post by TrevorDowdle » Thu Jul 12, 2012 4:30 pm

Thanks

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: How to create a new line (return) in live code

Post by dunbarx » Thu Jul 12, 2012 6:38 pm

Hi.

You were really very clever to think that making the script (sort of) look like what you wanted your text to look like would work. Adorable, but, well, no.

This is a good start to understand that control characters, like "return", "tab", etc., are part of building, and just as importantly, deconstructing, text in LC.

You will find enormous power in the ability to parse text via any character at all, in fact, and be able to separate, count, reorder or whatever, that text by using those characters as delimiters. Please read the dictionary under "itemdelimiter", and experiment.

In a sense, Sturgis' reply is saying that the return character is the delimiter for lines. There are others, and you need them all desperately. You will soon not know how you lived without them.

Craig Newman

Post Reply