If statement

Programming conditional statement that, if proved true, performs a function or displays information. Below is an example in plain English of an if statement and how it may be written in a programming language.

If X = 10 then print "X is equal to 10"

which could also be written as:

if ($x == 10) { print "X is equal to 10"; }

In the above example, if the X value was equal to 10, the program would display X is equal to 10. Note: the above example is a general example and does not apply to any programming language. See the conditional statement definition for further information and some basic programming examples.

Related pages

Also see: Conditional expression, Else, Exists, If else, Programming terms