As I occasionally do, I saw a number of search phrases that brought people to this blog and decided to make a post based on them. Lately, the most popular terms seem to be consultants trying to figure out if they can get out of their contracts and customers wondering if their consultants are going to try to get out of their contracts. Wow! Lots of unhappy situations, I guess! But since I’ve blogged several times on that topic, recently, instead, I’m going to pick this one “using the if statement for calculations in lims programming” which applies regardless the product because an IF statement is an IF statement.

What is an IF Statement?
An IF statement is part of what we would call a “conditional” statement. That means, it only happens based on some particular condition. To check this condition, it uses what we call “boolean logic” and a “boolean” has a value of TRUE or FALSE. Thus, if the condition is TRUE, the condition happens. If it’s FALSE, it doesn’t happen.

An Example
Suppose I have two numbers, X and Y. Also, suppose that if X is the largest that I want to report X, if Y is the largest, I want to report Y, and if they are equal, I want to put out text that states this. I could write that IF statement like this:

NOTE: I have problems keeping the indentation in this example so I have decided to use apostrophes to represent the spaces — in a real IF statement, there would not be these apostrophes.

IF ( X > Y ) THEN
”’RETURN X
ELSEIF ( X < Y ) THEN
”’RETURN Y
ELSE
”’RETURN “They Are Equal”
ENDIF