My print statement wont print my variable in my while loop

Lua Scripting Learner :

I have a block of code and I'm trying to make it so it counts down from 10, and prints it after 1 second, but nothing in the while loop will work. Any suggestions? (No errors or tips are popping up in Eclipse IDE)

    public static void main(String[] args) {
        int timer = 10;
        while (timer>10) {
            System.out.println(timer);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            timer = timer - 1;

        }
        System.out.println("Blast Off!");
    }
MT756 :

You set timer to 10, meaning that the program inside while (timer>10) will never gets executed.

I think you want while (timer > 0) instead

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=171006&siteId=1