Chapter 7

4 Pages
Unlock Document

Ryerson University
Information Technology Management
ITM 200
Vikraman Baskaran

Chapter 7 More control structures 7.1 Non-termination Non-terminating loop (aka infinite loop) occurs when there is either o No condition in the loop body for changing the variables used in the loop test o The variables are changed, but not in such a way that the test can eventually take the value false An unintentionally non-terminating loop is an example of a run-time error o The program runs forever and has to be stopped by the user Non-termination is not always an error, some control programs are not supposed to stop o For example, software to control a hospital life-support machine, or the cooling system of a nuclear power station 7.2 Nesting of if-else and while statements Example of a program on pg 143-145 Indentation When writing programs with nested control structures, it becomes even more important to use consistent indentation This makes the program much easier to understand and facilitates debugging and modification 7.3 The single-branch if statement Sometimes you want your programs to choose, not between 2 alternative actions but between 1 action and doing nothing In this case you can use a single-branch if statement Example on pg 145-146 Single-branch if statement Syntax o If ()
More Less

Related notes for ITM 200

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.