Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Title: Mar 2310:49 AM (1 of 15)
Three things you need to code to make aneffective loop:
Would be best to define ans as a var but since I did not when I add ct to ct and assign it to ans, the browser figures out I need a var ans and makes it for me.
Title: Mar 2311:08 AM (2 of 15)
Title: Mar 2311:20 AM (3 of 15)
Title: Mar 2311:26 AM (4 of 15)
Remember with the do...while the check of thecontrol is at the bottom. When the check is atthe bottom, the loop gets executed once beforethe check.
Title: Mar 2311:30 AM (5 of 15)
This works the same as the while that wewent through.
Title: Mar 2311:31 AM (6 of 15)
Note the definition ofvar i is not needed since it is done in thefor loop.
Title: Mar 2311:33 AM (7 of 15)
Title: Mar 2311:34 AM (8 of 15)
Title: Mar 2311:37 AM (9 of 15)
Title: Mar 2311:43 AM (10 of 15)
Title: Mar 2311:48 AM (11 of 15)
Title: Mar 2311:50 AM (12 of 15)
Note that I need the promptbetween the while checks.
Title: Mar 2311:57 AM (13 of 15)
Homework check for assignment
Title: Mar 2311:58 AM (14 of 15)
To approaches one thatassumes the user willonly enter 1,2 or 3 andone that checks forentering something else
Title: Mar 2312:09 PM (15 of 15)