D provides several ways to create loops. Here are some basic types of loops.
When you run this program, you’ll see:
D provides several looping constructs, including while, do-while, for, and foreach. The foreach loop is particularly useful for iterating over ranges and arrays.
We’ll see some other loop forms later when we look at ranges, arrays, and other data structures.