title: Inno Setup get Min and Max Integer values in Pascal Script
body: <p>I need to return min and max values of two Integers in many situations in my Pascal Script. But every time I need to create a <code>TStringList</code>, add my two or more Integers to it and convert it to an <code>Array Of String</code> and then get its min and max values using two of my functions called <code>ArrayOfStringMax</code> and <code>ArrayOfStringMin.</code></p>
  
  <p>I like to have two functions like <code>Min</code> and <code>Max</code> to make this easier like unit <code>Math</code> in Delphi.</p>
  
  <p>For example,</p>
  
  
  
  <pre class="lang-pascal prettyprint-override"><code>Log(IntToStr(Min(1000, 26)));
  </code></pre>
  
  <p>Output should be <code>26</code>.</p>
  
  <pre class="lang-pascal prettyprint-override"><code>Log(IntToStr(Max(45, 1989)));
  </code></pre>
  
  <p>Output should be <code>1989.</code></p>
  
  <p>Currently I only need <code>Min</code> and <code>Max</code> for <code>Integer</code> Type. If a function can be made to return minimum and maximum values even of <code>Single</code>, <code>Double</code>, <code>Extended</code>, <code>Int64</code> types, it will be a very useful function.</p>
  
  <p><strong>UPDATE</strong></p>
  
  
  
  <pre class="lang-pascal prettyprint-override"><code>procedure StringListToArrayOfString(StringList: TStringList; var ArrayOfString: Array Of String);
  var
    X: Integer;
  begin
    SetLength( ArrayOfString, StringList.Count);
    for X := 0  to (StringList.Count - 1)  do ArrayOfString[X] := StringList.Strings[X];
  end;
  
  function ArrayOfStringMax(ArrayOfString: Array of String): String;
  var
    X, M: Integer;
  begin
    M := StrToInt(ArrayOfString[Low(ArrayOfString)]);
    for X := 1 to High(ArrayOfString) do
    if StrToInt(ArrayOfString[X]) &gt; M then M := StrToInt(ArrayOfString[X]);
    Result := IntToStr(M);
  end;
  
  function ArrayOfStringMin(ArrayOfString: Array of String): String;
  var
    X, M: Integer;
  begin
    M := StrToInt(ArrayOfString[Low(ArrayOfString)]);
    for X := 1 to High(ArrayOfString) do
    if StrToInt(ArrayOfString[X]) &lt; M then M := StrToInt(ArrayOfString[X]);
    Result := IntToStr(M);
  end;
  </code></pre>
  
  <p>Those are the three functions I currently using in the Script.</p>
  
  <p>Thanks in advance.</p>