samedi 26 septembre 2015

Java: if statments and indents

So question about Java indents and if statements. I familiar with python where the info may not transfer 1 to 1.

So if I had a for loop with an if statement in it, and I close that if statement with a } but the next line has the same indention place as the if statement. What happens in the the new line, after the if statement is closed. For example.

for (int i = 0; i < 10; i++) {
   if (i == 5) {
       do something here;
   }

       what happens here, is this the else that's not written explicitly?
}

Aucun commentaire:

Enregistrer un commentaire