User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:loops:for

This is an old revision of the document!


for

   for ( init; condition; increment ){
    statements;    
    }

description of for

a for loop do statements while the condition is true/untrue, the increment counts the loop, it is possible to use more than 1 condition in the for loop

example of for example 1 in java

 
package codereferececomjava;
 
public class CodeRefereceComJava {
 
 
    public static void main(String[] args) {
 
        int myOtherCount=5;
 
 
        for (int i = 0; i <= myOtherCount; i++) {
            System.out.println("i is: "+ i + " <= " + myOtherCount );
         }
 
    }
}

output of for example 1 in java

  i is: 0 <= 5
  i is: 1 <= 5
  i is: 2 <= 5
  i is: 3 <= 5
  i is: 4 <= 5
  i is: 5 <= 5
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
java/loops/for.1366268460.txt · Last modified: 2024/02/16 01:02 (external edit)

Impressum Datenschutz