ID:171634
 
Seeing as how I suck at math and can't seem to figure out the equasion I need to get rid of this while loop, I'm offering anyone* who can tell me it a nice cold can of Coca-Cola.

var/money_taken = number_of_chips * chip_cost
while(money_taken > player_money)
money_taken -= chip_cost


* Certain restrictions may apply. This offer is only applicable to residents of the United States. Applicants must also be a resident of Florida, and must have spent atleast 100% of their lives in Jacksonville, FL, Sykesville, MD, Pontiac, MI, or a combination of all. Can will be set on YMIHere's front porch and you may only step foot on there if you are a) a resident of the house of YMIHere, b) YMIHere, and c) the sole owner of a Super Nintendo Entertainment System with the serial number UN16463575. ©, ©, all rights reserved, inc., yes we do own you, ®, ™, ©. If you are still eligible, knock it off already YMI. It wasn't funny at the beginning and it isn't funny now.

So, any help? =)
o_O
I would do "If", but, I've never seen the while statement.
You said Coca-Cola, I just want Coke.
In response to Hell Ramen
I have the while statement in there because the money taken can be more than 2*chip cost over the players money. If I used if, money_taken could still be more than the players money. The while will only stop when money_taken is down to an acceptable amount. =)
> var/money_taken = number_of_chips * chip_cost
> while(money_taken > player_money)
> money_taken -= chip_cost
>


Heh look at the while condition and think about it. You're looping until money_taken is greater than player_money. Where in the loop in money_taken ever increased so that it gets larger than the amount of money the player has :)?

Though I can't tell exactly what the loop should even do. You need to explain better what you're trying to achieve :P.
In response to Theodis
Theodis helped me take care of it in Chatters (by rounding player_money divided by chip_cost to get the maximum ammount of chips, if you must know), thanks again. =)


p.s. I regret to inform you that you are not eligible for the Coca-Cola, sorry.