Summary
In this chapter, we learned about writing conditional blocks and iterative statements. We understood how to use the if
conditional and its other flavors, such as if
, if-else
, and chaining multiple else-if
statements. Then, we learned how the goto
statement can help you to navigate to any labeled piece of code when working with if
blocks. In the Conditional blocks section, in addition to the if
statement, we learned about the match
block. We refactored the code example that is used to implement a chained else-if
statement using the match
block; following this, the code looked more organized and readable. Additionally, we understood the usage of a match
block as a traditional switch case and learned how to implement pattern matching with it.
This chapter also covered iterative statements in depth. We learned how to write the syntax of a basic for
loop, and then we discovered how to deal with arrays and maps using a for
loop. In addition to this, we explored how to reverse...