PDA

View Full Version : 99 Bottles displaying all numbers as it counts down


BadWolfGeronimo
12-29-2016, 04:09 PM
This may be a simple fix because I've read a bunch of bottles posts and can't find this problem. My countdown and loop works great except when the text pops up in the bubbles after the first iteration it just keeps adding the numbers in front of one another;

"96979899 bottles of beer on the wall."

What did I do wrong?

chickentree
12-30-2016, 01:44 AM
This may be a simple fix because I've read a bunch of bottles posts and can't find this problem. My countdown and loop works great except when the text pops up in the bubbles after the first iteration it just keeps adding the numbers in front of one another;

"96979899 bottles of beer on the wall."

What did I do wrong?

It is hard to say without seeing the program. If you have two variables, an integer for the count and a string for the display, then I would guess that the new string with the current number is being concatenated (added to) the front of the string variable rather than replacing it.
You need to either do an assignment rather than a concatenation, or ensure the variable holding the 'number' string is set to "" at the start of each loop.

Mark