F5 actionscript help

Dear reader,
I have been trying to make an RPG game:mario: for quite some time, what is the code so that the money dosen’t go under zero???Please help.

function deduct() {
if (money > 0) {
money--;
return true;
} else {
return false;
}
}

Made it a function just in case any animation for the deduction (like a counter going down) is required. Returns true or false determining whether or not the deduction was successful.

or

money = Math.max(money, 0);

:bad: oh yeah?

money = (money > 0) ? money : 0;

thor wins :hangover:

:pleased:

:love: