CSharp examples for Language Basics:if
Using the if...else statement and or to connect conditions
class MainClass//ww w.j a v a 2 s . com { static void Main() { char gender = 'x'; if( gender == 'm' || gender == 'f' ) { System.Console.WriteLine("The gender is valid"); } else { System.Console.WriteLine("The gender value, {0}, is not valid", gender); } System.Console.WriteLine("The if statement is now over!"); } }