Ruby - Iterators
Greeting Folks, This article is about Ruby Control Structure for iterators. Now iterators work a lot like loops which we just saw in the last movie. The difference is that instead of just looping, waiting for something to happen for us to take control and to either break out of it or to do something else, instead with an iterator we are going to traverse a fixed set of data. So we can kind of know where the starting point and the ending point is. We basically want to say for each one of these things do this process, do this loop, right. So we are going to do a code block once for each item in a set of data. Now we can accomplish that with loops. For example here is a While loop. Essentially what this while loop is doing is just outputting Hello five times. Before trying to do that, there is a simpler way to do it using the Ruby syntax, which is just to say 5.times do and then our code block. That...