If Expression

Why Trust Techopedia

What Does If Expression Mean?

The if statement is a programming language test that is done to determine whether a condition holds true. If the condition that is being tested holds true, a certain code is executed by the programmer that differs if it holds false. The if statement can be described with the Boolean expression, which produces a true or false value based on evaluation. The if statement is part of this evaluation.

Advertisements

Techopedia Explains If Expression

The if statement is used with an else statement when coding. Code is directed with the else statement depending on whether the if statement holds true.

In the example below, a manager will add a bonus of 5 percent to all employee salaries except those in the advertising department. Those employees will get a bonus of 8 percent added to their salary. The code for this looks like the following:

If
{Employee.Dept} = "Advertisement" Then
{Employee.Salary} * 0.08
Else
{Employee.Salary} * 0.05

Advertisements

Related Terms

Margaret Rouse
Technology expert
Margaret Rouse
Technology expert

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.