Source: https://www.fil.univ-lille1.fr/~L1S1Info/last/cours/081-while.pdf