Exiting a loop exits a function instead

Today I programmed in Inno Setup, and I read the Pascal documentation that says exit used to exit the loop. I tried to use this in my code, and instead it exited the function. For example, in this function, a message box will never be displayed:

 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 searches, and Pascal also has a break keyword, so I used it and it works correctly. Is it possible to use exit to exit a function? I remember that in the afternoon I realized that Pascal does not have the equivalent of a C-style return expression.

I really need some good documentation for the version of Pascal that Inno Setup uses. I have read Inno's help pages, but they do not cover such things. Thanks

+4
source share
1 answer

You are using the wrong documentation, your link refers to Sun Workshop Compiler Pascal 4.2 . Inno customization is used as a scripting language. RemObjects Pascal Script . This is a Pascal dialect similar to Delphi, the official Pascal Sripting documentation used by Inno is here , you can also check out Marco CantΓΉ's Essential Pascal .

+8
source

Source: https://habr.com/ru/post/1412464/


All Articles