title: How to repeat "if" statement when output is false
body: <p>I am working on a simple game in which the user has to guess a random number. I have all the code set up except for that fact that if the guess is too high or too low I don't know how to allow them to re-enter a number and keep playing until they get it. It just stops; here is the code:</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Random;
  
  public class Test {
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          Random rand = new Random();
  
          int random = rand.nextInt(10) + 1;
  
          System.out.print("Pick a number 1-10: ");
          int number = input.nextInt();
  
          if (number == random) {
              System.out.println("Good!");
          } else if (number &gt; random) {
              System.out.println("Too Big");
          } else if (number &lt; random) {
              System.out.println("Too Small");
          }
      }
  }
  </code></pre>