#Concept #Study #CPP
Simple if else statements can be replaced by a ternary operator.
The ternary operator consists of a condition and one case if the condition is false and another if the condition is true.
```cpp
_variable_ = (_condition_) ? _expressionTrue_ : _expressionFalse_;
```
Example:
```cpp
int time = 20;
string result = (time < 18) ? "Good day." : "Good evening.";
cout << result;
```
## 🔗Resources
### Ternary operators
- https://www.w3schools.com/cpp/cpp_conditions_shorthand.asp