Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
99 Bottles displaying all numbers as it counts down
Old
BadWolfGeronimo
Junior Member
 
Status: Offline
Posts: 14
Join Date: Dec 2016
Default 99 Bottles displaying all numbers as it counts down - 12-29-2016, 03: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?
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 210
Join Date: Dec 2012
Location: Frosno, Ca
Default 12-30-2016, 12:44 AM

Quote:
Originally Posted by BadWolfGeronimo View Post
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


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.