Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

Reply
 
Thread Tools Display Modes
Loops with if/else
Old
Alex Rodriguez
Guest
 
Status:
Posts: n/a
Default Loops with if/else - 03-27-2009, 09:09 AM

This assignment had me make an object sing the song "99 bottles of pop on the wall" and have it count down. I had some trouble with ordering everything and making the number count down as well as have it loop 99 times. What I was making my mistakes were having enough variables. A smart friend in my class, David, helped me figure out what I was doing wrong, which was not having enough variables. Once he showed me that I needed to have the lyrics of the song as variables, and also a variable for the number of bottles as the song is sung. I then took those variables and and combined them with a a with b string function. The order in which all these statements go are another thing I am having problems with.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 02-26-2010, 06:34 PM

Well if you can post it someone may be able to look at it. I possibly could but running short on time


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 02-26-2010, 06:52 PM

The statements of the variables would be nested in the loop something like this:

Number joined with String
decrement the Number by 1

I would also list to say that you can modify the complicated version of the loop and use the "index" variable to make the code really efficient, but I'll leave that for you to figure out
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-22-2010, 10:31 PM

You should be able to do this with only 1 variable....the number of bottles.
   
Reply With Quote
Old
King Gamer(gorit)
Guest
 
Status:
Posts: n/a
Default 03-23-2010, 08:47 PM

Quote:
Originally Posted by rankhornjp View Post
You should be able to do this with only 1 variable....the number of bottles.
Yeah that and a 99(I think) loop.
   
Reply With Quote
Old
rankhornjp
Guest
 
Status:
Posts: n/a
Default 03-25-2010, 01:35 PM

did you get this figured out?
   
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 ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.