L3 - Selection and Repetition Constructs in Java

L3 - Selection and Repetition Constructs in Java - L3...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
L3 Selection and Repetition Constructs in Java Loops, while and for
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
How to Master this objective Read Gaddis, Chapter 4. Watch Dr. A’s video here: http://faculty.valenciacc.edu/colin_archibald/2800VideoLec ture/07%20Repetition%20- %20Looping/07%20Repetition%20-%20Looping.html Check out these links from the Learning Objectives document http://download.oracle.com/docs/cd/E17409_01/javase/tu torial/java/nutsandbolts/while.html http://download.oracle.com/docs/cd/E17409_01/javase/tu torial/java/nutsandbolts/for.html Write/enhance a short sketch in class to see how these work in Processing
Image of page 2
While Loop Really a repeated if The while keyword is followed by a boolean expression in parentheses If true, the loop is entered and repeated while the expression is true If false, the loop is skipped entirely.
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Code generated for while int counter = 1 ; while ( counter <=4 ) { // do some stuff counter ++ ; } // more stuff int counter = 1 ; mov counter, 1 while ( counter <=4 ) StartOfLoop: Compare counter to 4 Jump greater than EndOfLoop { // do some stuff inc counter Jump always StartOfLoop } EndOfLoop: // more stuff
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern