samedi 21 novembre 2015

For loop to close/exit application

This code is supposed to close the application when all tiles on a board are == to null, but currently when the loop runs it exits the application as soon as it finds just 1 tile that is null. How do I fix that?

Thanks!

public void close(){
        for (int row = 0; row < 4; row++){
            for (int col = 0; col < 4; col++){
                if (tiles[row][col] == null) {
                    System.exit(0);
                }
            }
        }
    }

Aucun commentaire:

Enregistrer un commentaire