D: Loops


The D programming language has the following types of loop (repitition) statements:

  • For loop
  • While loop
  • Do loop
  • Foreach loop

Example: For Loops in D


	import std.stdio;
	void main() {
		 
		for (int i = 0; i < 5; i++)
			writeln(i);

	}
	

Output:

  0
  1
  2
  3
  0