Exit method | Result |
Pas2JS pascal source code
type TMyClass = class function MyFunc(i: Integer): Integer; end; function TMyClass.MyFunc(i: Integer): Integer; begin if i <= 0 then Exit(-1) else begin Result := i; if i = 10 then Exit(i + 1) else if i > 10 then Exit(Result + 2) end; end; { main.pas } var o: TMyClass = TMyClass.Create; Begin WriteLn(o.MyFunc(0)); WriteLn(o.MyFunc(5)); WriteLn(o.MyFunc(10)); WriteLn(o.MyFunc(11)); { <<< CONSOLE OUTPUTS >>> -1 5 11 13 }