PDA

View Full Version : New Assignment, New questions.


ChrisDavidson
07-25-2013, 01:52 AM
First, Thank you to all the forum members and classmates who have posted great responses to my somewhat noobish and ambiguous questions. Sorry I am new to this.

So I am making a 99 bottles of beer on the wall scene. Of course I want to make it with as little code as possible. I set the variable of "pop" to 99.

Then

say Pop as a string--joined with bottles of pop on the wall X2
take one down
say Pop = Pop - 1 as a string joined with bottles of pop on the wall

When I run this, the last line says "false bottles of pop on the wall". So this has led me to believe I didn't set the variable right. So I need to make a statement that reduces the original value of the variable pop by 1 in each time it runs. I figured this would be done by using an index?

Lastly my loop statement. I was going to nest the entire above inside

Loop index from Pop, up to and not including 98 times incrementing by -1.

Any help is greatly appreciated, Thank you in advance.

ChrisDavidson
07-25-2013, 02:39 AM
Ok I got it, and it might even be perfect. I even added in a fancy chair that my teacher is going to like. When I figured it out I jumped around quite emphatically, but then realized how obvious the answer was. You can change the variable at any time.

eug3n10
07-26-2013, 11:06 PM
It took me a while myself to think through the process logically and be able to put in in code. It sure feels good when it clicks.

MrMoke
07-30-2013, 03:30 PM
One of those Classic projects to visualize Looping.

I used a while that stopped at zero with a cowboy and cowgirl in the saloon. She gets to say the "take one down" line :-) To make it more fun, I created an array of bottles on the balcony behind the bar, and made one disappear during each iteration. Oh Yeah, I dropped it to 10 to save time and bottles.

Have fun:cool:

sonataalex
08-22-2013, 04:17 AM
Thanks for your marvelous posting! Free high quality icons are all selected from the internet, just click our site to choose best icons for you!
----
Kizi (http://www.kizi2.com)