If-then-else clauses have the form:

if <conditional-expression> then <expression1> else <expression2>

If statements require both a 'then' and 'else' clause or they will throw an error.

Both <expression1> and <expression2> must have the same type, and <conditional-expression> must be a singular boolean.

If <conditional-expression> is true, then <expression1> is evaluated and returned; otherwise <expression2> is evaluated and returned.

Starting with version 5.1 of IBM BigFix, if-then-else clauses have been implemented as late-binding, so potential vocabulary errors on the branch not taken are ignored. This makes it safe to write cross-platform Relevance expressions without worrying about throwing errors for incorrect OS-specific Inspectors. For instance, you can write:

Q: if name of operating system contains "Win" then name of application "conf.exe" 
of registry else "conf.exe"
A: conf.exe
I: singular string

On a non-Windows OS, this expression will execute the ‘else’ expression and avoid an attempt to inspect a non-existent registry.

Note: Prior to version 5.1 of IBM BigFix, both branches were checked to be sure they were meaningful, which could generate an error. In that case, a parse error would have occurred on any non-Windows system when the unknown keyword ‘registry’ was encountered.

If-then statements can be useful for reporting user-defined errors:

Q: if (year of current date as integer < 2006) then "Still good" else error
E: User-defined error: Expired

This expression throws a user-defined error if the argument is false.

Q: if (name of operating system = "WinXP") then "wired" else if (name of operating
system ="WinNT") then "tired" else "expired"
A: wired

This expression does a three-way test of the operating system.