And/Or
We'll cover the following...
We'll cover the following...
Let’s say I’m selling movie tickets and we give a discount to people under 18, as well as to people 65 and older. I’d like to write a function gets_discount(). I can state the requirement in almost-code as age < 18 OR age >= 65. Unfortunately, that OR isn’t real Rust code. Instead, it’s time to introduce the or operator, which is two pipes || (hold shift and hit the backslash key on most keyboards).
Exercise
Implement the gets_discount function correctly to make this program pass.
The or operator is binary, so it takes two values. I’ll explain this the same way I explained or above.
-
If either or both values are true, it evaluates ...