Source: http://www.i3s.unice.fr/~malapert/R/pdf/04-iterations-while.pdf