The
<IF ExecutionTarget> compile statement allows you to compile or not compile a WLanguage code depending on the execution target.
This statement is mainly used to easily get a multi-configuration code, without displaying any compilation errors.
Remark: In general,
<COMPILE IF> compilation conditions should be used as much as possible to manage the differences between different platforms. However, when any of the configurations that use the code needs to adapt to multiple execution targets, it is necessary to use <IF ExecutionTarget>.
<IF ExecutionTarget=WindowsApplication OR ExecutionTarget=Java>
Open(WIN_Menu)
<END>
<IF ExecutionTarget=Android OR ExecutionTarget=iOS>
OpenMobileWindow(WIN_Menu)
<END>
<IF ExecutionTarget=Site>
PageDisplay(PAGE_Login)
<END>
Syntax
Single execution target
<IF <ExecutionTarget=<Target name>>
... // Code if the condition is true
<END>
Combination of conditions
<IF <ExecutionTarget=<Target name> OR <ExecutionTarget=<Target name2>>
... // Code if the condition is true
<END>
Using the <> operator
<IF <ExecutionTarget <> <Target name>>
... // Code if the condition is true
<END>
Using an ELSE block
<IF <ExecutionTarget <> <Target name>>
... // Code if the condition is true
<ELSE>
... // Code if the condition is false
<END>
Remarks
<Target name> parameter
The different targets are as follows:
- Android
- AppleWatch
- DotNetApplication
- LinuxApplication
- WindowsApplication
- DotNetAssembly
- Library
- ExternalComponent
- iOS
- iOSWidget
- Java
- Linux
- MacCatalyst
- RADPattern
- ActionPlan
- WebSocketServer
- WebSocketServerLinux
- WebSocketServerWindows
- LinuxService
- WindowsService
- Site
- SiteLinux
- PHPSite
- SiteWindows
- UniversalWindowsApp
- Webservice
- WebserviceLinux
- WebserviceWindows
- Windows
- You cannot declare global variables in an <IF ExecutionTarget> statement.
- Local variables must have unique names for all execution targets.