Hour 13. Making Decisions in Visual C Code


Hour 13. Making Decisions in Visual C# Code

What You'll Learn in This Hour:

  • Making decisions using if statements

  • Expanding the capability of if statements using else

  • Evaluating an expression for multiple values using the switch statement

In Hour 10, "Creating and Calling Methods," you learned to separate code into multiple procedures so that they can be called in any order required. This goes a long way in organizing code, but you still need a way to selectively execute code procedures or groups of statements within a procedure. You can use decision-making techniques to accomplish this. Decision-making constructs are coding structures that enable you to execute or omit code based on a condition, such as the value of a variable. Visual C# includes two constructs that enable you to make any type of branching decision you can think of: if...else and switch.

In this hour, you'll learn how to use the decision constructs provided by Visual C# to perform robust yet efficient decisions in Visual C# code. You'll probably create decision constructs in every application you build, so the faster you master these skills, the easier it will be to create robust applications.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

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