Skip to content

Instantly share code, notes, and snippets.

@carneeki
Last active December 10, 2015 09:09
Show Gist options
  • Save carneeki/4412649 to your computer and use it in GitHub Desktop.
Save carneeki/4412649 to your computer and use it in GitHub Desktop.
Demonstrate loops using for() syntax
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