lower() functionWhile this switch statement solution is elegant and works perfectly, it does not meet the original exercise requirement which specified using a "single nested if-else statement". This solution is presented as an alternative approach that demonstrates good MATLAB programming practices.
| Feature | Switch Statement | If-Else Statement |
|---|---|---|
| Case Handling | Uses lower() to simplify |
Explicitly checks each case |
| Readability | Very clean for multiple cases | Clear but more verbose |
| Exercise Compliance | ❌ Does not meet requirements | ✅ Meets requirements |