I wrote the following code :

```
import java.util.Scanner;
public class Ex6_Page25 { //Nimrod - check exit on zero

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        System.out.print("Enter number: ");
        int number=input.nextInt();
        int sum=0;
        double avg=0;
        int counter=0;

        while(number!=0)
        {
            if(number>0)
            {
                counter++;
                sum+=number;
                System.out.print("Please enter another number: ");
            }
            else
            {
                System.out.print("number cannot be negative.\n"
                                   + "please enter another one: ");
            }
            number=input.nextInt();
        }

        avg=sum/counter;
        System.out.println("The average of all numbers is: " + avg);
    }
}

```

In the upper part of my code, just before the while loop, is it possible to configure it in a way that when the user types in 0 or -1, the program wont enter the while loop at all? ( like a break command )

I have tried using the break; command, but as I found out, its being used in loops only?