Thread: assignment 6
View Single Post
Old
willy0227
Junior Member
 
Status: Offline
Posts: 8
Join Date: Jul 2016
Default 07-19-2016, 12:12 AM

I like your use of if statements to accomplish this, but there is a simpler way to do this. I used a while statement that ran as long as my variable was <= 99 AND > 1. Then I ran the statements with my variable for the first 2 lines. Then decremented my variable by 1, and ran the final line. This ran the loop over and over until it equals 1. Then outside the loop I put the same statements changing bottles to bottle and it finished. I will say it frustrated me that I couldn't do this with a loop and decrement the index instead of increment. Even if I could, it would not let me do any math on the index while it was in the "as a string" function. This is how I would have done it in the other languages I know.
   
Reply With Quote