How to use the logical operator "!"?



I want to do a while loop with a string.

The loop turns while the string IS NOT equal to a string I specify.

I try to use the ! operator but it doesn’t works.

Witch are the negation operator in UiPath?



Hi @nSangui,

Since UIPath is based on VB .NET to develop artifacts, in this case the correct operator is Not.

For example:



“!” is a C operator, you need VB.Net (which btw is “Not”).
You can check VB.Net operators here:



You can use <> for not equal.
example: value <> 1


Sidenote; I tend to avoid using Not when there is more than one condition as it gets confusing. For example if you had

Not isMale or age > 21

Would that be interpreted as not Male and not over 21 or not Male and could be any age? Without testing I’m not sure hence why I would avoid using Not.


So what do you use instead of not?


Try to make the operation a positive one, so rather than saying

not age > 21


age <= 21

to avoid the confusion. Not always possible, if it gets too confusing just use one nested if (but no more than one!! :slight_smile: )