Convert Boolean to String with Inno Setup

[Code]
function BoolToStr(Value : Boolean) : String; 
begin
  if Value then
    result := 'true'
  else
    result := 'false';
end;

or

[Code]
function IsDowngradeUninstall: Boolean;
begin
    Result := IsCommandLineParamSet('downgrade');
    if Result then 
      MsgBox('IsDowngradeUninstall = True', mbInformation, MB_OK)
    else
      MsgBox('IsDowngradeUninstall = False', mbInformation, MB_OK);
end; 

If you need it once only, the easiest inline solution is to cast the Boolean to Integer and use the IntToStr function. You get 1 for True and 0 for False.

MsgBox('IsDowngradeUninstall = ' + IntToStr(Integer(Result)), mbInformation, MB_OK);

Though, I usually use the Format function for the same result:

MsgBox(Format('IsDowngradeUninstall = %d', [Result]), mbInformation, MB_OK);

(Contrary to Delphi) The Inno Setup/Pascal Script Format implicitly converts the Boolean to Integer for %d.


If you need a more fancy conversion, or if you need the conversion often, implement your own function, as @RobeN already shows in his answer.

function BoolToStr(Value: Boolean): String; 
begin
  if Value then
    Result := 'Yes'
  else
    Result := 'No';
end;