PDA

View Full Version : Math and Variable problems


ptrcklgrs
12-28-2005, 12:17 AM
Fot some reason im having problems with using variables and math functions.

Ive enterd this code into my computer and it returns "undefined".

ang = 3;
math.tan (ang);

and it wont work. But if i enter

math.tan (3);

it works fine. Am i messing up at labling the variable. I tried other names for the variables but it doesnt make a difference. originally the problem occured in a much longer code but i got down to testing it and this was the problem.
HELP!!!

Headshotz
12-28-2005, 12:41 AM
I tried

var ang = 3;
test = Math.tan(ang);
trace(test);


It gave the same results as


test = Math.tan(3);
trace(test);

ptrcklgrs
12-28-2005, 02:27 AM
Thanks i figured it out. This is wierd shit.
If you use do it like this:

math.tan (3);

its ok. If you do it like this its not ok:

dat = 3;
math.tan(dat);

but if you do it like this. Your ok:

dat = 3;
Math.tan(dat);


You have to use a capital M when using variables

Headshotz
12-28-2005, 06:24 AM
I thought it was always a capital M, I thought you wouldve got a syntax error with the small one.