Difference between revisions of "Control Structures"
Line 14: | Line 14: | ||
==[[Control Structures Review Questions and Exercises|Review Questions and Exercises]]== | ==[[Control Structures Review Questions and Exercises|Review Questions and Exercises]]== | ||
+ | |||
+ | ==[[Control Structures Solutions|Solutions]]== | ||
{{Category:COMP 1010}} | {{Category:COMP 1010}} | ||
{{Category:Java}} | {{Category:Java}} |
Revision as of 15:37, 20 March 2007
Chapter #Control Structures are blocks of code that force the computer to make a decision. Sometimes you will want your program to perform different tasks depending on certain boolean conditions. For example if you were writing a game you would probably find it very useful to be able to know when the user has won the game so that you could show a high scores page. If control structures were not used then programs would begin at the first line and excecute every line of code in order, giving the same output every time. Imagine how boring Tetris would be if there was only one piece! Control structures allow you to change the order of execution, jumping from one section of code to another as needed. | ||
---|---|---|
Write a Program a Day | Case Studies |
Table of Contents |
---|
The If-Statement
The If-Else Statement
Conditions
Nesting
Review Questions and Exercises
Solutions
Template loop detected: Template loop detected: