CompilerIf

Just starting out? Need help? Post your questions and find answers here.
Jarlve
Posts: 19
Joined: Mon Jun 18, 2018 6:10 pm

CompilerIf

Post 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
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: CompilerIf

Post 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
Jarlve
Posts: 19
Joined: Mon Jun 18, 2018 6:10 pm

Re: CompilerIf

Post by Jarlve »

Thanks Peter.
Post Reply