Inno Setup "return" like command/construct in Code

5.3k views Asked by At

Is there any command/construct like return in C that exits immediately from a function of Inno Setup script code keeping the result code?

I would like something

If k = false then
Begin
    Result:=false;
    Exit;
End;
1

There are 1 answers

0
Martin Prikryl On BEST ANSWER

Your code is correct.

Use the Exit statement to exit a function or a procedure. With the function, set the Result automatic variable, before you call the Exit, to set the return value.

function MyFunction: Boolean;
begin
  if not SomeTest then
  begin
    // cannot do stuff, aborting
    Result := False;
    Exit;
  end;

  // do stuff

  Result := True;
end;