[if] – If BBCode

If statement:[if CONDITION ]
    Text
[/if]


If and else statement:
[if CONDITION ]
    Text
[else]
    Text
[/if]


If, elseif and else statement:
[if CONDITION ]
    Text
[elseif CONDITION ]
    Text
[else]
    Text
[/if]


BBCodes:

AttributeExamplesDescription
if*[if a == b ]
a is equal to b
[/if]
The condition to check.
Required.
elseif[if a == 1 ]
a is equal to 1
[elseif a == 2 ]
a is equal to 2
[/if]
Extra conditions to check when [if] condition is not meet.
Optional.
else[if a == 1 ]
a is equal to 1
[else]
a not meets any condition
[/if]
Content after [else] is displayed when none of the [if] or [elseif] conditions are meet.
Optional.

Conditions:

AttributeExamplesDescription
CONDITION*[if a == b ]
a is equal to b
[/if]
The condition to check.
Required.
Logical Operators[if a == 1 AND b == 2 ]
a is 1 AND b is 2
[/if]

[if a == 1 OR b == 2 ]
a is 1 OR b is 2
[/if]

[if a == 1 AND b == 2 AND c == 3 OR d == 4 ]
All conditions are meet
[/if]
Logical operators can combine multiples conditions. AND operator forces to meet both conditions while OR operator accepts to pass only one of them.
Accepts: AND or OR.
Optional.
Comparison Operators*[if a *= b ]
a contains b
[/if]

[if a ^= b ]
a starts with b
[/if]
Comparison operators defines how to compare the values in a condition.

a == b : Equal
a === b : Equal (in value and type)
a != b : Not equal
a !== b : Not equal (in value and type)
a > b : Greater than
a >= b : Greater than or equal to
a < b : Less than
a <= b : Less than or equal to
a <=> b : Less than, equal to or greater than
a *= b : Contains
a *== b : Contains (case sensitive)
a !*= b : Not contains
a !*== b : Not contains (case sensitive)
a ^= b : Starts with
a ^== b : Starts with (case sensitive)
a !^= b : Not starts with
a !^== b : Not starts with (case sensitive)
a $= b : Ends with
a $== b : Ends with (case sensitive)
a !$= b : Not ends with
a !$== b : Not ends with (case sensitive)

Required.