How do I concatenate variables?

Get help using Construct 2

» Mon Jun 06, 2016 9:55 pm

Hi!,

So, I have 2 vars, example:

x=2
y=1

And I want z to be x and y, one besides the other, not a sum:

z=21

I've been using &, but it is for string concatenation and gives me an error. (z always equals 1 that way).

Thanks!
B
26
S
8
Posts: 84
Reputation: 1,722

» Mon Jun 06, 2016 10:34 pm

set z to int(x&y)
B
97
S
36
G
131
Posts: 5,511
Reputation: 83,460

» Mon Jun 06, 2016 10:43 pm

R0J0hound wrote:set z to int(x&y)

Tried it and not working
B
26
S
8
Posts: 84
Reputation: 1,722

» Mon Jun 06, 2016 10:58 pm

str(x)&str(y)

The "&" operator is both string concentration and logical and. If both values are numbers then logical and is used otherwise string concentration is used.
B
97
S
36
G
131
Posts: 5,511
Reputation: 83,460

» Mon Jun 06, 2016 11:17 pm

str(x)&str(y)

The "&" operator is both string concentration and logical and. If both values are numbers then logical and is used otherwise string concentration is used.

Thanks, it is working now!
B
26
S
8
Posts: 84
Reputation: 1,722