Last active
December 10, 2015 09:09
-
-
Save carneeki/4412649 to your computer and use it in GitHub Desktop.
Demonstrate loops using for() syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoopFor | |
{ | |
public static void main (String[] args) | |
{ | |
for(int i=1; i<=10; i++) // here we create our counter, then set the condition, | |
// and finally increment the counter all in one line | |
{ | |
System.out.println(i); // this is where we do our stuff | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment