section iii
Program Statements
The lessons in Section II focused on working with variables. They explained how to declare
variables, set their values, and perform calculations.
Those techniques let you do some fairly complex things, but theyre still relatively straight-
forward things that you could do yourself by hand if you really had to. For example, you could
easily calculate line item totals, sales tax, shipping, and a grand total for a purchase order.
With what you know so far, you really can’t write a program that takes full advantage of the
computer’s power. You cant make the program add up an unknown number of values stored in
a
ListBox, perform the same task (such as calculating an account balance) for thousands of cus-
tomers, or take different actions depending on the user’s inputs. You can’t even write a program
that can tell if the user entered “seventy-eight” in a
TextBox that should contain a number.
The lessons in this section explain how to perform these kinds of tasks. They explain ways
you can make a program take different courses of action depending on circumstances, repeat
a set of actions many times, break code into manageable pieces to make it easier to write and
debug, and handle unexpected errors. After you finish reading these chapters, you’ll be able to
write applications that are much more powerful than those you can write now.
LESSON 18: Making Choices
LESSON 19: Repeating Program Steps
LESSON 20: Reusing Code with Methods
LESSON 21: Handling Errors
LESSON 22: Preventing Bugs
596906c18.indd 217 4/8/10 8:13:15 AM
596906c18.indd 218 4/8/10 8:13:16 AM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.63.41