title: How do I make sure that the user enters a number between 0 and 10 only?
body: <p>I have made an array with all my subjects called subjectName. The goal of this code is to make sure that the user only enters valid numbers (between 1.0 and 10.0). but I don't know how to do that. I created an if statement and make it return if the subjectname isn't between 0 and 10 but that doesn't work. I am not sure how I can tackle this. </p>
  
  <p>EDIT: subjectName are the names of each subject so its a String. subjectGrade is a double. BOTH ARE ARRAYS. Forgot to mention that. </p>
  
  <p>This is my code:</p>
  
  <pre><code>for (int i = 0; i &lt; subjectName.length; i++) {
              Scanner input = new Scanner(System.in);
              System.out.print("What is your grade for: " + subjectName[i] + "? ");
              subjectGrade[i] = input.nextDouble();
  
              if ( subjectGrade[i] &lt; 0.0 || subjectGrade[i] &gt; 10.0) {
                  return;
              }
  </code></pre>