title: Loop termination confusion
body: <p>So I have this code to enter a series of integers to a sequence but I would like to know how can I terminate the while loop just by entering no values and pressing enter. I know that I can put a condition like terminate the loop if the x integer value is 0. </p>
  
  <pre><code>public static void main(String[] args) {
  SimpleReader in = new SimpleReader1L();
      SimpleWriter out = new SimpleWriter1L();
      Sequence&lt;Integer&gt; s = new Sequence1L&lt;&gt;();
      Sequence&lt;Integer&gt; temp = s.newInstance();
      System.out.println("Enter ");
      int x = in.nextInteger();
      int i = 0;
      while (in.nextLine()) {
          s.add(i, x);
          x = in.nextInteger();
          i++;
      }
      System.out.println(s);
  }
  </code></pre>