Page 1 of 1

CompilerIf

Posted: Tue Jun 26, 2018 7:17 am
by Jarlve
This code is in my program and does not seem to be needed to make it work. Is it needed in some cases? What does it do?

Code: Select all

CompilerIf #PB_Compiler_OS<>#PB_OS_Web
Repeat
Event=WaitWindowEvent()
Until Event=#PB_Event_CloseWindow
CompilerEndIf

Re: CompilerIf

Posted: Tue Jun 26, 2018 9:13 am
by Peter
With this compiler query you can test under which operating system your code runs. In your example, the event loop will only be included in the compilation if you do not run the code in the web browser.

So you can (theoretically) run your code without big changes under Windows, Linux, MacOS with PureBasic and in the web browser with SpiderBasic. If you only want to program for the web, you can remove the compiler query.

Greetings ... Peter

Re: CompilerIf

Posted: Tue Jun 26, 2018 11:01 am
by Jarlve
Thanks Peter.