Page 1 of 1

variable in a message

Posted: Wed Oct 13, 2021 6:59 pm
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:

Re: variable in a message

Posted: Wed Oct 13, 2021 7:10 pm
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

Re: variable in a message

Posted: Wed Oct 13, 2021 7:14 pm
by Samuele
wow, such speed! thanks so much, it worked.