variable in a message

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

variable in a message

Post by Samuele »

hello, i've been using livecode for sometime now, i have a question, how can i put a variable into a text message for example "answer your new high score is _gHighScore (a variable) but in a way that it actually works? :roll:
Samuele.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: variable in a message

Post by Klaus »

Hi Samuele,

welcome to the forum!
You need to create the appropriate string with & like this:

Code: Select all

...
answer "Your new high score is" && _gHighScore
...
-> & "adds" two strings:
put "text1" & "text" -> text1text2
-> && "adds" two strings with a SPACE:
put "text1" && "text" -> text1 text2

Best

Klaus
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: variable in a message

Post by Samuele »

wow, such speed! thanks so much, it worked.
Samuele.
Post Reply