mercredi 13 février 2019

for loop without boolean parameter

Without the if statement is an infinite loop printing 0 to an infinite number. Why adding the if statement prints 0 and 0 again and again if ?

for (int zz=0; ;zz++ ) {    //with the if statement 
if(zz==0)System.out.print(zz+"zz \n");
//System.out.print("....");

}

for (int zz=0; ;zz++ ) {    //without if statement.
System.out.print(zz+"zz \n");
}

Aucun commentaire:

Enregistrer un commentaire