Home » ASP.NET Basics » 07 - Writing code and handling events
7
Decisions
Concepts of decisions
So far, our codes have been simple. Declare the variables, write statements to process the data using operators and output the result. In real life however, programs are not so simple. Many times, we need to make decisions in the program. A very good example is a program to find if a number is even or odd. We know that if the number is divisible by two, the number is even. Otherwise, it is an odd number. But how do we implement such a decision in our C# code?
C# provides two methods for making decisions:
§ if - else
§ switch - case