mardi 1 juin 2021

Whats wrong in this basic Java loop and if? [closed]

Been several years since I programmed in Java. I was writing this code:

   for(int i1=1; i1<=10; i1++);
   {
      for(int i2=1; i2<=10; i2++);
      {
         if(i2 != i1)
         {
            System.out.println("FDF");
         }
      }
   }

When I suddenly get an error message:

Error: cannot find symbol symbol: variable i1 location: class AllGenerator

I find it very confusing. I am assuming I have some basic syntax mistake, but I am not sure where. The if(i1 != i2) is defined inside the scope of the inner for-loop, so no error like this should happen. What am I missing?

Aucun commentaire:

Enregistrer un commentaire