Welcome to WebmasterWorld Guest from 54.196.100.224

Forum Moderators: open

Message Too Old, No Replies

Combinding variables.

How would I make var B and var A into one variable?

     
12:58 am on Sep 6, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:June 16, 2007
posts: 120
votes: 0


Lets say I wanted to make variable Bob and variable Joe into one variable, so if Bob=1, and Joe=2, the variable would be 3. Then, with that new variable that holds 3, how could I add B in front of it so it looked like B3?

Bob=1
Joe=2
New variable= B3

Thanks!
:)

3:29 pm on Sept 9, 2008 (gmt 0)

New User

5+ Year Member

joined:Aug 6, 2007
posts: 7
votes: 0


Something like:

var temp:Number = Bob + Joe;
String new_var = temp as String;
new_var = "B" + temp;

...haven't tested it but this should work or show you the right direction

3:30 pm on Sept 9, 2008 (gmt 0)

New User

5+ Year Member

joined:Aug 6, 2007
posts: 7
votes: 0


for the last line, i meant:

new_var = "B" + new_var;