Hi, can someone please let me know how I can add two assigned variables in a single sentence. i can do it with one e.g. "this is an example for a single", variable.
But how can I do the same but with two or more variables. Sorry if this seems like a newbie question but I have tried searching for the answer but to no avail. Im doing this for an alert function
Thanks in advance.
do you mean:
a = b = c = 7;
string p=", ";
I'm not sure that I understand correctly, but this may give you a pointer
Trying taking a look at StringFormat() / PrintFormat()
Thanks for the replies. Sorry if I wasn't clear before but what I mean is for instance
int A= 31
int B = 66
and I want to display an alert I would write
Alert("The value of variable A is ", A)
My question is how would I do the alert but display both A and B variables. I have tried something like
Alert("The value of variable A is ",A "and variable B is ",B)
but compiler returns an error.
// Method 1
Alert("The value of A is "+(string)A+" and B is "+(string)B);
// Method 2
Alert(StringFormat("The value of A is %i and B is %i",A,B));
// Method 3
Alert(StringConcatenate("The value of A is ",A," and B is ",B));
you have to put a comma after A
To add comments, please log in or register