I cannot see the value of variable "its" lazarus / 61-Beginners ---------------------------------------------------------------------- juanirias · 2016-06-17 21:12 Hi! This calculates the square root of a content of a file. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program RootFinder;const   maxits = 100;type  itcounts = 0..maxits;var  number, startval, sqroot, tolerance : real;  its, bound : itcounts;  solved : boolean;  MyFile : text; procedure FindSqRoot(v,x,tol:real; itbound:itcounts;                      var success:boolean;                    var root:real; noofits:itcounts);var  itcount : itcounts;  state : ( trying, doneit, toomanyits);begin  itcount := 0;  state := trying;  repeat     if (abs(sqr(x)-v) <= tol) then state:=doneit else      if (itcount=itbound) then state:=toomanyits else        begin        x := ( x + v/x )/2.0;          itcount := itcount + 1;        end  until (state <> trying);  success := ( state = doneit );  if success then    begin      root := x;      noofits := itcount    endend; { of procedure FindSqRoot }  begin  assign (MyFile, 'MyFile');  Reset(MyFile);  repeat    readln(MyFile,number,startval,tolerance,bound);    write(number:10:6,startval:10:6,' ',tolerance:8,bound:7);    FindSqRoot(number,startval,tolerance,bound,solved,sqroot,its);    if solved then writeln(sqroot:13:6,its:8) else      writeln('     -            -');  until eof(MyFile);  writeln;  writeln('All supplied number have been processed')end.  the file mus have this form: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 9.000000 1.00000 1e-5 250.123450 0.50000 1e-6 40512.0000 10.0000 1e-10 50  BUT I don't see the number of iterations ---------------------------------------------------------------------- rvk · 2016-06-17 21:20 Code: [Select]procedure FindSqRoot(v,x,tol:real; itbound:itcounts;                      var success:boolean;                      var root:real;    noofits:itcounts); //                                  ^^^ didn't you forget something here You have a parameter noofits without the var before it. So your noofits will never be returned with the new value. Make it a var parameter and it should work. ---------------------------------------------------------------------- juanirias · 2016-06-17 21:22 Thanks ! I learn something today...