Actionscript help
Discussion
Hi, i'm using the following code to compare two numbers. The code looks fine to me, but when testing, it gives some wrong results. For example, with a=200 and b=100, it correctly realises that a is bigger than b and returns 'increased'. However, if a=200 and b=50, it gets the results wrong and returns decreased, even though a is still bigger than b???
This is really confusing me. Am i missing something?
Anyway, here is the code:
_global.compare = function(a, b) {
if (a>b) {
return 'increased';
} else if (a<b) {
return 'decreased';
} else {
return 0;
}
};
This is really confusing me. Am i missing something?
Anyway, here is the code:
_global.compare = function(a, b) {
if (a>b) {
return 'increased';
} else if (a<b) {
return 'decreased';
} else {
return 0;
}
};
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


