title: Got "Boolean" expected "LongInt" pascal
body: <p>I get this error on my insertion sort algorithm:</p>
  
  <blockquote>
    <p>insertionsort.lpr(19,17) Error: Incompatible types: got "Boolean" expected "LongInt"</p>
  </blockquote>
  
  <p>Here's the line 19 of my code</p>
  
  <pre><code> while j &gt; 0 and A[j]&gt;key do            
  </code></pre>
  
  <p>I have tried googling all over the internet but i couldn't find any syntax errors or anything.</p>
  
  <p>Here's the full code if it helps :</p>
  
  <pre><code>program instert;
  uses crt;
  const
    N = 5;
  var
     i:integer;
     j:integer;
     key:integer;
     A : Array[1..N] of Integer;
  
  
  procedure insertionsort;
    begin
    for i := 2 to N  do
      begin
      key := A[1];
      j:= i - 1;
          while j &gt; 0 and A[j]&gt;key do
          begin
            A[j+1] := A[j] ;
            j := j-1;
          end;
      A[j+1] := key ;
     end;
   end;
  
  begin
    A[1]:= 9;
    A[2]:= 6;
    A[3]:= 7;
    A[4]:= 1;
    A[5]:= 2;
    insertionsort;
  end.
  </code></pre>
  
  <p>I also get the same error on the bubble sort algorithm i did. Here's the error line </p>
  
  <blockquote>
    <p>bubblesort.lpr(26,14) Error: Incompatible types: got "Boolean" expected "LongInt"</p>
  </blockquote>
  
  <p>Here's line 26 of my algorithm:</p>
  
  <pre><code> until flag = false or N = 1 ;   
  </code></pre>
  
  <p>Here's the full code:</p>
  
  <pre><code>program bubblesort;
  uses crt;
  
  var
    flag:boolean;
    count:integer;
    temp:integer;
    N:integer;
    A : Array[1..N] of Integer;
  
  procedure bubblesort ;
  begin
    Repeat
      flag:=false;
      for count:=1 to (N-1)  do
      begin
      if A[count] &gt; A[count + 1] then
         begin
         temp := A[count];
         A[count] := A[count + 1];
         A[count] := temp;
         flag := true;
         end;
      end;
      N := N - 1;
    until flag = false or N = 1 ;
  end;
  
  begin
    A[1]:= 9;
    A[2]:= 6;
    A[3]:= 7;
    A[4]:= 1;
    A[5]:= 2;
    N := 5;
    bubblesort;
  end.
  </code></pre>