title: While loop vs Repeat loop delphi
body: <p>Was looking on Google if there was a major difference betweeen <code>while</code> and <code>repeat..until</code> loops, I didn't find anything useful or what I was looking for.</p>
  
  <p>I noticed that the <code>while</code> loop makes my programs unresponsive, and the <code>repeat</code> works better than <code>while</code>. Is there any specific reason for this, or should one use one another in different scenarios?</p>
  
  <p>Here's my code in a <code>while</code> loop:</p>
  
  <pre><code>var
    m,val : Integer;
    i,k   : Real;
  begin
    val := StrToInt(edtShot.Text);
    i := sqr(k);
    k := sqrt(i+val);
    m := 0;
  
      while i &lt;= 0 and k &lt;= 10 do
        begin
          inc(m);
        end;
  end;
  </code></pre>
  
  <p>and here it is with a <code>repeat</code> loop:</p>
  
  <pre><code>var
    m,val : Integer;
    i,k   : Real;
  begin
    val := StrToInt(edtShot.Text);
    i := sqr(k);
    k := sqrt(i+val);
    m := 0;
      repeat
        inc(m);
      until i &gt; 0 and k &gt; 10;
  end;
  </code></pre>
  
  <p>BTW I know the code above doesn't really make much sense, just an example.</p>