Exiting from a loop exits the function instead

inno-setup, pascal

Solution

You are using the wrong documentation, your link refers to the `Sun Workshop Compiler Pascal 4.2`. Inno setup uses as scripting language The `RemObjects Pascal Script` Which is a Delphi-like Pascal dialect, the official documentation of the Pascal Sripting used by Inno is located here, additionally you can check the `Marco Cantù's Essential Pascal`.

Problem

I've been coding in Inno Setup this afternoon and I read some Pascal documentation which says that `exit` is used to exit a loop. I tried using that in my code and instead it exited the function. For example in this function the message box will never be shown: ``` function NextButtonClick(CurPageID: Integer): Boolean; var i: Integer; begin Result := True; for i := 0 to 4 do begin exit end; MsgBox('test',mbInformation,MB_OK); end; ``` I did some more googling and Pascal also has the `break` keyword so I used that and it works properly. Is `exit` really supposed to be used to exit the function? I recall reading this afternoon that Pascal does not have the equivalent of a C style return statement. I really need some good documentation for the version of Pascal that Inno Setup is using. I have read the Inno help pages but they don't cover things like this. Thanks

Original source