Function Reference


_Assert

Display a message if assertion fails

#include <Debug.au3>
_Assert ( $sCondition [, $bExit = True [, $iCode = 0x7FFFFFFF [, $sLine = @ScriptLineNumber]]] )

Parameters

$sCondition The condition (expression quoted) that must evaluate to true.
$bExit [optional] If true (Default), the script is aborted.
$iCode [optional] The exit code to use if the script is aborted.
$sLine [optional] Displays the line number where the assertion failed. If this value is not changed, then the default value will show the correct line.

Return Value

Returns the result of the condition (Only valid when not exiting).

Remarks

@error and @extended are not destroyed on return.
If _DebugSetup() has been call, instead of displaying a MsgBox(),
_DebugReport() will be used and $bExit will be force to False to avoid script termination.

Related

_DebugReport, _DebugSetup

Example

#include <Debug.au3>

_DebugSetup(Default, True)

Example()

Func Example()
        Local $sABC = ""
        #forceref $sABC

        _Assert('$sABC > ""')
        _Assert('$sABC > ""')
EndFunc