Show TOC

if StatementLocate this document in the navigation structure

Use

Purpose

Performs conditional substitutions on an HTMLBusiness expression.

Syntax

if (expression) statement
{[elsif | elseif] (expression) statement }
[else statement ]
end
            

Description

The if statement allows you to perform conditional substitution in your HTML document.

The if statement in HTMLBusiness is similar to the syntax and semantics of other common programming languages such as C and JavaScript. Since nesting is possible, if statements can contain other if statements. The same embedding is also allowed for the repeat statement.

The keywords elsif and elseif can be used as alternatives.

Example

In the syntax description, the term expression refers to any expression that evaluates to a truth value, that is, to 0 (FALSE) for conditions not met, or not equal to 0 (TRUE) for conditions met.

The following is an example of this kind of expression:

vbcom-kunde >= 1000
vbcom-kunde
j % 3 == 0
j / (4 - 1) != a * (b + (c + 2))
s == "Walter" & " " & "Weissmann"
(x > 2 && x <99) || (s > "abc")
         

The following are examples of if statements:

Example 1:

`if (vbcom-kunde) vbcom-kunde else` Undefined Customer Number `end`
         

Example 2:

`if (j % 3 == 0)` <TR> `else` <TD> `end`
         

Example 3:

`if (1)
 write("This branch is always true!")
elsif (0)
 write("This branch is never true!")
else

 write("The impossible occurred!")
end`
         

Example 4:

`if (x > 0 && x < 100)`
<!-- x is greater than 0 and smaller than 100 -->
 `if (y > 0 && y < 100)`
<!-- y is greater than 0 and smaller than 100 -->
 `elsif (Y > 100)`
<!-- y is greater than 100 -->
 `end
elsif (x <= 0)`
<!-- x is smaller than 0! -->
`else`
<!-- x is greater than 99! -->
`end`
         
Note

The operators <, <=, > and >= are not defined for character strings. If you use them with character strings, the strings are automatically converted into numerical values.