Let’s dive into Ruby's control structures, iterators, and exceptions.

Method calls are statements. Ruby also provides a number of ways to make decisions that affect the repetition and order in which methods are invoked.

Control structures

Ruby has all the usual control structures, such as if statements and while loops. Java, C, and Perl programmers may get caught by the lack of braces around the bodies of these statements though, since Ruby uses the end keyword to signify the end of a body:

Get hands-on with 1200+ tech skills courses.