15-statement-forms

15-statement-forms - CS 106A Handout #15 July 1, 2009...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout #15 CS 106A July 1, 2009 Control Structures On the schedule for today is a discussion of Java’s control structures, which are described in Chapter 4. This handout offers some additional notes that emphasize the important concepts and then describes a problem that we will solve together in class. The solution will be available after class as Handout #15A. To write programs, you need to understand control structures from two perspectives: you must have a holistic sense of when to use them and why, but you must also learn to understand the reductionistic details. For this big-picture perspective, you can rely to a large extent on your experience from Karel: If you want to test a condition that requires an if statement in Karel, you need the if statement in Java. If you would use the while or for statement in Karel, you will presumably use the same statement form in Java. The other holistic point that is essential about control statements is that the control line is conceptually independent from the body. Thus, if you see a construct like for (int i = 1; i <= 10; i++) { Control line statements Body }
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

15-statement-forms - CS 106A Handout #15 July 1, 2009...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online