title: Using while on a method returning multiple values
body: <p>Here I'm trying to use <code>while</code> on a method using also <code>while</code> in order to return multiple values from a SQL request. Where am I wrong here? Is there another way than using <code>boolean</code> to do this?</p>
  <p>Database table</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">1st Column</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">1000</td>
  </tr>
  <tr>
  <td style="text-align: center;">900</td>
  </tr>
  <tr>
  <td style="text-align: center;">800</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Program printing the values from the table</p>
  <pre><code>public class someClass {
      
      public static int value;
  
      public static boolean getValues() throws SQLException {
          ResultSet valuesResult = requestQuery(valuesQuery);
          while (valuesResult .next()) {
              value=  sessionUsersResult.getInt(1);
              return true;
          }
          return false;
      }
  
      public static void main(String[] args) {
          Database.connect();
          while (getValues()) {
              System.out.println(value);
          }
      }
  }
  </code></pre>
  <p>Actual result in the console</p>
  <pre class="lang-none prettyprint-override"><code>1000
  1000
  1000 ...
  [infinite loop]
  </code></pre>
  <p>Expected result</p>
  <pre class="lang-none prettyprint-override"><code>1000
  900
  800
  </code></pre>