4D v14.3

SET ASSERT ENABLED

Home

 
4D v14.3
SET ASSERT ENABLED

SET ASSERT ENABLED 


 

SET ASSERT ENABLED ( assertions {; *} ) 
Parameter Type   Description
assertions  Boolean in True = enable assertions False = disable assertions
Operator in If omitted = command applies to all the processes (existing or created subsequently) If passed= command applies to current process only

The SET ASSERT ENABLED command can be used to disable or re-enable any assertions inserted into the 4D code of the application. For more information about assertions, please refer to the description of the ASSERT command.

By default, assertions added in the program are enabled. This command is useful when you want to disable them since their evaluation can sometimes be costly in terms of execution time and you may also want them to be hidden from the final user of the application. Typically, the SET ASSERT ENABLED command could be used in the On Startup database method in order to enable or disable assertions according to whether the application is in "Test" mode or in "Production" mode. 

By default, the SET ASSERT ENABLED command affects all the processes of the application. To restrict the effect of the command to the current process only, you can pass the * parameter.

Please note that when assertions are disabled, expressions passed to ASSERT commands are no longer evaluated. The lines of code that call this command no longer have any effect on the operation of the application, neither in terms of behavior, nor in terms of performance.

Example  

Disabling assertions:

 SET ASSERT ENABLED(False)
 ASSERT(TestMethod) // TestMethod will not be called since assertions are disabled

 
PROPERTIES 

Product: 4D
Theme: Interruptions
Number: 1131

 
HISTORY 

Created: 4D v12

 
SEE ALSO 

ASSERT
Asserted
Get assert enabled

 
ARTICLE USAGE

4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)