Now let's exercise our new skills with complex conditions. Let's solve a few practical tasks.
Watch this video to review what we learned in this chapter: https://youtu.be/QOhyJXZ0HHQ.
Before proceeding ahead, let's remind ourselves about the new program constructs and techniques that we have learned in this chapter.
if (condition1)
{
if (condition2)
// body;
else
// body;
}
if ((x == left || x == right) && y >= top && y <= bottom)
Console.WriteLine(…);
switch (selector)
{
case value1:
construction;
break;
case value2:
case value3:
construction;
break;
…
default:
construction;
break;
}
Solve the exercises below to learn how to work with nested and more complex conditions: