Ruby Nested Ternary Operator
1 2 |
|
Nested ternary operators provide a concise method to express if
-elsif
-else
statements.
We set wheels = 2
then our nested ternary opertor evaluates whether wheels == 0
, if so, it returns Unknown Vehicle
, if not, it evaluates whehter wheels <= 2
, if so, it returns Unicycle/Motorcycle/Scooter
, if not, it returns Car/Truck
.