July 2011
Intermediate to advanced
400 pages
8h 46m
English

Much of programming is concerned with repetition. Maybe you want your program to beep 10 times, read lines from a file as long as there are more lines to read, or display a warning until the user presses a key. Ruby provides a number of ways of performing this kind of repetition.
In many programming languages, when you want to run a bit of code a certain number of times, you can just put it inside a for loop. In most languages, you give a for loop a variable initialized with a starting value that is incremented by 1 on each turn through the loop until it meets some specific ending value. When the ending value ...
Read now
Unlock full access