Page 1 of 1
Put large text into a variable
Posted: Fri Jul 22, 2011 3:23 pm
by Val_UK
Hi, I need to be able to put something like a text below into a variable
"My name is Val.
I live in New Orleans.
I love seafood."
I know how to put a single line text into a variable - put "My name is Val" into myVar1. I am a little bit confused about how to do the same thing with a multi line text (see above).
Any help is very appreciated.
Val
Re: Put large text into a variable
Posted: Fri Jul 22, 2011 3:30 pm
by Klaus
Hi Val,
welcome to the forum!
Just add a RETURN (or shorter CR) to your strings!
...
put "My name is Val." & CR & CR & "I live in New Orleans." & CR & CR & "I love seafood." into myVar
answer myVar
...
Will give:
My name is Val.
I live in New Orleans.
I love seafood.
Best
Klaus
P.S.
check these stacks, great learning resources!
http://www.runrev.com/developers/lesson ... nferences/
Re: Put large text into a variable
Posted: Fri Jul 22, 2011 3:44 pm
by Val_UK
Hi, Klaus,
Thank you for the help. One more related question - if this line becomes too long, how can I start a new line without breaking the code?
Thank you.
Val
Re: Put large text into a variable
Posted: Fri Jul 22, 2011 4:00 pm
by Klaus
Hi Val,
you mean in the script editor?
You can use a BACKSLASH as a not_breaking_the_code_new_line
Like this:
Code: Select all
...
put "This is a very very long line that will surely make reading extremely difficult and " & \
"is a pain to script in this script editor, but there is the handy BACKSLASH!" into myVar
...
will result in ONE line in the variable.
You get the picture!
Best
Klaus
Re: Put large text into a variable
Posted: Fri Jul 22, 2011 5:21 pm
by Val_UK
Thank you, Klaus!