The if/else statement can be used to execute a single statement in both the if and the else part, or to execute a block of statements. A block of statements can be executed if curly braces ({, }) are used.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| // Example 1 - block of statementsif (age >= 50){ Console.WriteLine("Hey, you should consider joining AARP!"); DisplayDetailsOfAARPMembership();}else{ Console.WriteLine("You're still a young pup"); DisplayInfoAboutVideoGames();}// Example 2 - single statementsif (airfare < 850.00) BookTickets();else PlanARoadTrip();// Example 3 - mixedif (married){ KeepPlaceClean(); RaiseKids(); LearnInterpersonalSkills();}else PlayVideoGames(); |

