Flexible Comparison Statements

A few weeks ago I gave someone an answer that included code similar to this:

IF Nospace(MyString) = "TestString"

And Wolfgang Kirsch pointed out the flexible comparison operators in the online help.

So the statement can be written as

IF Mystring ~= "TestString"

I have been trying to use this more as I feel it is a bit cleaner, but I tend to have a lot of <> statments like

IF Nospace(mystring) <> "TestString"

I wasn’t sure how to use the flexible comparisons without using reverse logic for that

IF mystring ~= "TestString"
    // nothing here
    mycode here

But I found that you can use the NOT operator in combination with the flexible operators so, it can be written as

IF mystring NOT ~= "TestString"


Now, back to your regular schedule program….

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s