This video is taken from the Scripting Learning Track on Ansys Innovation Courses.

## Transcript

Logical operators can be used in scripting.

You can use equal to, not equal to, less than, less than or equal, greater than, greater

than or equal to compare variables.

Note that when performing a comparison such as less than, greater than, the imaginary

part will be ignored.

You can also perform a logical and, a logical or.

The almost equal function allows you to compare 2 floating point numbers that could be equal,

but are not exactly equal due to rounding errors.

These operators will return 1 (true) if the condition is met, 0 (or false), if not.

Lastly, you can perform a logical not operation.

These logical operators can be used in if/then statement, in for loops but also in operations.

For instance, we can create a filter array z that is equal to 1 if x^2+y^2 is less than

or equal to 7.

This is equivalent to a disc of radius equal to 7 (as plotted).