Chapter 5: Using Compound Assignment and Iteration Statements


Chapter 5

Using Compound Assignment and Iteration Statements

After completing this chapter, you will be able to:

  • Update the value of a variable by using compound assignment operators.

  • Write while, for, and do iteration statements.

  • Step through a do method, and watch as the values of the variables change.

In Chapter 4, “Using Decision Statements,” you learned how to use the if and switch constructs to selectively run statements. In this chapter, you'll see how to use a variety of iteration (or looping) statements to repeatedly run one or more statements. When you write iteration statements, you usually need to control the number of iterations that you perform. You can achieve this by using a variable, updating its value with each iteration, and stopping the process when the variable reaches a particular value. Therefore, you'll also learn about the special assignment operators that you should use to update the value of a variable in these circumstances.




Microsoft Visual C# 2005 Step by Step
Microsoft® Visual C#® 2005 Step by Step (Step By Step (Microsoft))
ISBN: B002CKYPPM
EAN: N/A
Year: 2005
Pages: 183
Authors: John Sharp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net