title: Pascal duplicate identifier
body: <pre><code>program Noname4;
  
    function minutes (Amin, Bmin :integer) : integer;
  
    function time (Aval, Bval :integer) : integer;
    begin
      if (0 &lt;= Aval) and (Bval &lt; 24) then
        time :=Bval - Aval;
      if (0 &lt;= Amin) and (Bmin &lt; 60) then
        minutes :=Bmin - Amin;
    end;
  
   var Aval, Amin, Bval, Bmin, n , x , i , y :integer;
     duom, rez : text; 
   begin
     readln(Aval, Amin, Bval, Bmin );
     writeln(time(Aval, Bval));
     writeln(minutes(Amin, Bmin));
     readln;
     assign(duom, 'Duomenys2.txt');
     Reset(duom);
     Readln(duom, n );
     assign(rez, 'rezultatai2.txt');
     rewrite(rez);
  
     for i := 1 to n do
     begin
       Readln(duom, Aval, Amin, Bval, Bmin);
       x := time(Aval, Bval);
       y := minutes (Amin, Bmin);
       writeln(rez, x);
       writeln(rez, y);
     end;
     close(duom);
     close(rez);
   end.
  </code></pre>
  
  <p>Hello, I am getting a error (duplicate identifier, identifier already defined in line 2). It shows red in the ( duom, rez : text; ) line. Can't find out why  </p>
  
  <hr>
  
  <pre><code>program Noname4;
  
  function minutes (Amin, Bmin :integer) : integer;
  function time (Aval, Bval :integer) : integer;
  begin
    if (0 &lt;= Aval) and (Bval &lt; 24) then
      time :=Bval - Aval;
    if (0 &lt;= Amin) and (Bmin &lt; 60) then
      minutes :=Bmin - Amin;
  end;
  var Aval, Bval, n , x , i , y :integer;
    duom, rez : text;
  begin
    assign(duom, 'Duomenys2.txt');
    Reset(duom);
    Readln(duom, n );
    assign(rez, 'Rezultatai2.txt');
    rewrite(rez);
    for i := 1 to n do
    begin
      Readln(duom, Aval, Bval, Amin, Bmin);
      x := time(Aval, Bval);
      y := minutes(Amin, Bmin);
      writeln(rez, x);
      writeln(rez, y);
    end;
    close(duom);
    close(rez);
  end;
  
  begin
  end.
  </code></pre>
  
  <p>I did what you said, the program now works fine except it doesn't write the the answer in 'Rezultatai2.txt' file.</p>