469,293 Members | 1,566 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,293 developers. It's quick & easy.

add variables into one

I am trying to add variables into one.
var a:Number =1;
var b:Number =2;


trace(a+b);

Then ill get 11. I know its adding the numbers up as strings. if i did
trace(a-b); then i would get 0. Do you know how i can add them together?
Mar 6 '07 #1
2 5675
never mind i used number(b) + number(c)
Mar 7 '07 #2
bno
8
If you are concatenating the strings "1" and "2" and coming up with "11" you should worry.

you could of simply declared a var c e.g....

Expand|Select|Wrap|Line Numbers
  1. var a:Number = 1
  2. var b:Number = 2
  3. var c:Number = a + b
  4. trace(c)
  5.  
Mar 8 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Torsten Bronger | last post: by
7 posts views Thread by Michael | last post: by
7 posts views Thread by misha | last post: by
5 posts views Thread by Sandman | last post: by
4 posts views Thread by icarus | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.