Domino Code Fragment

Code Name*
Conditional Branching: The IF Statement
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.118.0.240
Description*
The IF statement is used to execute other statements based on one or more conditions. Some of the logic used for an IF statement is demonstrated in the following pseudo-code examples:
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
1. If a condition(s) is met, execute the following statement(s), otherwise execute the following statement(s)
OR
2. If a condition(s) is not met, execute the following statement(s), otherwise execute the following statement(s)

An IF statement is composed at minimum of the IF, Then, and End If keywords. Additionally, the keywords Else and ElseIf can be used, or statements can be nested one within the other to create more complex conditions. More information can be found on these topics through The Extra Mile.


Syntax:

If condition Then
statements
Else
statements
End If

Click here to view example.

Dim X As Integer 'Declare X as type Integer
X = 10 'Assign X the numeric value 10
If X = 10 Then 'If X is equal to 10
MessageBox "X is equal to 10" 'Tell the user X is equal to 10
Else 'Otherwise, if X is not equal to 10, (Which
'cannot happen here)
MessageBox "X is not equal to 10" 'Tell the user X is not equal to 10
End If 'End of IF loop

The following example checks to see if the value entered into an inputbox is numeric. (The function IsNumeric tests a value to see if it is numeric. If it is numeric, it returns a value of True. If it is not numeric, it returns a value of False.) If the value is not numeric, an error message is displayed.

Click here to view the example.