Loops in Rust

Rust has the standard loops one might expect, such as a while (conditional) style loop, and a for (counting) loop. As with most modern languages, it also has a for each style loop. A Bad Type of Loop… One thing that is unique however, is that it also includes a built in infinite loop, which…

Repetition with Ruby

The Ruby method each allows you to iterate over a list of items. This is essentially a for-each style of loop and is like JavaScript’s each method. Notice that the iterative value is placed inside of two pipe (|) characters. You don’t have to put everything on one line. In fact, you can’t if you have multiple…

Break and Continue

We’ve seen the break in a switch statement. It stops running the blocks of code, and simple exits out of the switch. In the same manner, if you use a break in a loop, it exits us from the loop prematurely (not by the loop condition). The continue keyword moves us to the end of…