Thread: Testing A-6
View Single Post
Super Moderator
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 07-30-2017, 07:18 PM

Originally Posted by cdeleon View Post
Looking to finish Assignment 6. Currently in the works. I think mostly everyone is done with this assignment. However, this is what I have so far. Ok I tried uploading the file as a regular a2w, and as a zip. Both uploads failed. Any advice? @chickentree
As to your problem:

You are using a while loop. The loop will continue until the condition changes to false. So if you had a boolean variable called keepGoing and it was initially set to true the loop
while keepGoing
    do stuff 
     change endingCondition
     if endingCondition then
        keepGoing = false
Would keep going untill the ending condition became false. The ending condition could be anything you make it. in this case you might do something that reduces the value of start and then test to see if it is 2.
What you have right now is
while true
This will continue to repeat until true becomes false, which is never. It is what is called an endless loop and is almost always a bad idea.
Note that in your program you could just put the ending condition in the while statement, like
while start >2
This would work fine. The first example was to give you a better understanding of what was happening and how 'while' works in general.

All that being said, the 'for' loop would be a better choice. In general, if you know the number of times something is going to happen ahead of time choose the 'for' loop. If you drag the loop statement into 'my first method' you will see it has a 'show complex version' button. clicking this will show you the values the loop is using. Especially note the 'index'
variable. The index is what changes each time the loop is run
A test loop would look like this:
loop index from 0 up to but not including 100 times incrementing by 1
    print index
This will print out the value of index in a box below the movie screen.
To see this you will need to right click on the while block and disable it.
Ask yourself why?
Finally, the index values are counting up from 0 to 99 but you want the values to start at 100 and count down. I am leaving this as an exercise for you along with answering the question above. I will say the answer is very simple.

If you need more help let me know

Mark Henwood
Reply With Quote