How can I make a Java loop with an interval?


I can’t find how you can make loops with intervals.
This isn’t really a Codecademy course thing, just trying to code on my own.

You have to look at the increment (sometimes called step).
Here’s a reference in the docs (always a good place to look when you want to learn more about anything): The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)

Taking the code example from there if we change the increment to i+=2:

for(int i=1; i<11; i+=2){
              System.out.println("Count is: " + i);

we get this output:

Count is: 1
Count is: 3
Count is: 5
Count is: 7
Count is: 9

Note, for increment you can’t write i+2 it has to be i+=2 (I’m just using 2 as an example, it can be any number.