30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

162 Control Structures: Part 2 Chapter 5<br />

Testing and Debugging Tip 5.6<br />

In a counter-controlled loop, make sure the control variable is incremented (or decremented)<br />

appropriately in the body of the loop. 5.6<br />

Testing and Debugging Tip 5.7<br />

In a sentinel-controlled loop, make sure the sentinel value is eventually input. 5.7<br />

Testing and Debugging Tip 5.8<br />

Including a final value in the condition of a repetition structure (and choosing the appropriate<br />

relational opera<strong>to</strong>r) can reduce the risk of off-by-one errors. For example, in a While<br />

loop used <strong>to</strong> print the values 1–10, the loop-continuation condition should be counter

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!