What is a loop?
A loop is a way of repeating lines of code. If you want to for example print Hello on the screen 10 times then you can either use System.out.println 10 times or you can put 1 System.out.println in a loop that runs 10 times which takes a lot less lines of code.For loop
The for loop goes from a number you give it to a second number you give it. It uses a loop counter variable to store the current loop number. Here is the format for a for loop: for (set starting value; end condition; increment loop variable)
You first set the loop counter variable to...
0 comments:
Post a Comment