Is it possible to to declare variables within a condition?
<p>This is how I would do a while loop:</p>

<pre><code>boolean more = true;
while (more)
{
  // do something
  if (someTest()) 
  {
    more = false;
  }
}
</code></pre>

<p>That's pretty standard. I'm curious to know if there's a way of doing something similar to the code below in Java: (I think I've seen something like it in C)</p>

<pre><code>// The code below doesn't compile (obviously)
while (boolean more = true)
{
  // do something
  if (someTest())
  {
    more = false;
  }
}
</code></pre>

<p>I only ask this because currently I don't like the way I'm defining the variable used in the condition (in this case: "more") <em>outside</em> the scope of the loop, even though it's only relevant <em>inside</em> the loop. There's no point it being left hanging around after the loop has finished.</p>

<hr>

<p><strong>* * Update * *</strong></p>

<p>An idea came to me following a visit to the Porcaline Chamber of Secrets:</p>

<pre><code>for (boolean more=true; more; more=someTest())
{
  // do something
}
</code></pre>

<p>It's not perfect; It's abusing the for loop and I can't think of a way to execute the loop <em>at least once</em>, but it's close... Is there a way to make sure the loop is performed 1+ times?</p>
