CS 151 Lecture 10: Sections 5.1-5.2

94 views2 pages

Document Summary

The order in which statements are executed in a running program is called the flow of control. Unless otherwise specified, the execution of a program proceeds in a linear fashion. A running program starts at the first programming statement and moves down one statement at a time until the program is complete. Invoking a method alters the flow of control. When a method is called, control jumps to the code defined for that method. When the method completes, control returns to the place in the calling method where the invocation was made, and processing continues from there. Conditionals and loops allow us to control the flow of execution through a method. A conditional statement is sometimes called a selection statement, because it allows us to choose which statement will be executed next (if, if-else, switch) Each decision is based on a boolean expression (also called a condition), which is an expression that evaluates to either true or false.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents