Locked lesson.
About this lesson
We learn how to use "or" operators within If/Else statements.
Exercise files
Download this lesson’s related exercise files.
33 - Logic If else Or Operators.docx61.4 KB 33 - Logic If else Or Operators SOLUTION.docx
58.7 KB
Quick reference
Logic: If/else Or Operators
The Or operator || allows you to evaluate more than one thing at a time.
When to use
Use when you need to evaluate more than one thing, and not all of them need to be true.
Instructions
int a,b;
a = 20;
b = 19;
if (a > b || a < 100)
{
Console.WriteLine($"{a} is Greater than {b} or less than 100");
}
Hints & tips
- || // or operator
- Or is used to evaluate more than one thing but not all of them need to be true
Lesson notes are only available for subscribers.