Not operator performs logical negation on Boolean expression. We will see how to use this Not operator in UiPath. It is a Visual Basic (VB) operator.
Syntax:
result = Not expression
where, result is a variable of type Boolean and expression is a Boolean expression.
For example, if the expression is True, then result will be False. Also, if the expression is False, then the result will be True.
Usage in UiPath
Initialize two variables of type Integer and assign them a value using Assign activity. I have used num1 and num2 as Integer variables and assigned them the value 5 and 16 respectively.

I will show you two ways of using the Not operator in UiPath:
- Using Assign activity and print the result value on output console.
- Using If Condition activity
Using Assign activity
Add another Assign activity and create a variable result of type Boolean. Assign the value of result with the below expression.
result = Not (num1 > num2)
Use a Write Line activity to print the result on the output console.

The expression (5 > 16) evaluates to False. The negate of expression is True. Therefore, the result value on the console is True.

Using If Condition activity
Add an If activity and write the below condition. Also, put a Write Line activity to print the respective comments on the output console.
Not (num1 < num2)

The expression (5 < 16) evaluates to True. The negate of expression is False. Therefore, the control will go to Else part and print Inside Else on the output console.



Leave a Reply