In This Lecture, We Will Discuss : Flow of Control
In This Lecture, We Will Discuss : Flow of Control
▪ Flow of Control
▪ if / elsif / else
▪ case
▪ until / unless?
▪ while / for
▪ Two “flavors”
1. Similar to a series of “if” statements
2. Specify a target next to case and each when clause
is compared to target
▪ No fall-through logic
7
Case Expressions
For Loop
▪ Hardly used
9
Summary
▪ Lots of options for flow of control
▪ Modifier form is an interesting way to be very expressive
▪ Non-nil and non-false values are always true
What’s next?
▪ Functions / Methods