Some loops to munch on
1. The ‘for’ loop:
1 2 3 | for(int i = 1; i < 10; i++){ System.out.println("Hello World!"); } |
You’ve seen it before so I wont go into detail however note the definition of type on Line 1, int i.
2. The while loop:
1 2 3 4 5 | int i = 1; while(i < 10){ System.out.println("Hello World!"); i++; } |
Again, nothing too new but this is Java.
3. The ‘do-while’ loop:
1 2 3 4 5 | int i = 1; do { System.out.println("Hello World!"); i++; } while(i < 10) |
This is the while loop but switched around as it performs the action before doing any checks at all.

