0
Upcoming SlideShare
×

# 8. Loops I

38

Published on

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

Views
Total Views
38
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
1
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript of "8. Loops I"

1. 1. From last time… • We played with Pong! • Please turn in Homework 1
2. 2. Proposal! Feedback CAP
3. 3. Proposals • Check your email, take action if needed! • Scope, deﬁnition, and clariﬁcations! • Thoughts and examples! • Think of this as a loose ‘contract’! • Next steps: iteration plan and group formation
4. 4. What is Agile? CAP
5. 5. (Semi-) Agile • Follow “user stories” rather than speciﬁcations! • Frequent check-ins (scrums) with your team! • 2 week development cycles (sprints)! • We will be meeting in groups on a regular basis, will have quick scrums, then show off our work, ~ 3 week development sprints
6. 6. Looooooooops CAP
7. 7. while() while (conditional_statement) { // execute this code }
8. 8. Demo! While Loops
9. 9. Inﬁnite Loops (!!!) while (conditional_statement) { // execute this code } • If your conditional statement is never going to be false, the loop will never stop executing! • This is bad.
10. 10. for() for (int i = 0; i < 10; i++) { print(i); } ! 0123456789
11. 11. 1. Initialization • Declare and initialize a variable! • Most often: • This could be used as a counter inside the loop, or could be ignored within the loop for( int i = 0;
12. 12. 2. Boolean Test • Create a conditional statement that must evaluate to true or false! • Most often: • We’ve seen these conditional statements before i < numberOfIterations;
13. 13. 3. Iteration Expression • What happens at the end of each loop?! • Most often: • Increment or decrement are common here i++) {}
14. 14. Memorize the For Loop for (int i = 0; i < 10; i++) { print(i); } ! These are extremely helpful in many ways and you will use them often
15. 15. Demo! Nested For-Loops
16. 16. Particle Fever http://www.youtube.com/watch?v=Rikc7foqvRI
17. 17. Particle Fever http://www.youtube.com/watch?v=Rikc7foqvRI
18. 18. For next time… • Read and respond to your proposal feedback (if you haven’t already)! • Memorize the for loop! • Read Shiffman, p. 90–98 (Loops II)! • Also… start thinking about Iteration 1
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.