devxlogo

Set a Flag to True/False

Set a Flag to True/False

When you want to set a flag to True or False, depending on the results of a comparison, you don’t need to use an If statement like this:

 If x > 3 then	Greater = TrueElse	Greater = FalseEnd If

Logical operators return a value like any other operator. Instead, use this syntax:

 Greater = x > 3

This way, you move directly to the result of the comparison in your flag. It is shorter and faster than the form example.

devx-admin

Share the Post: