subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!
If _condition_ Then
'statements
End If
If _condition Then
' Code to execute if the condition is true
Else
' Code to execute if the condition is false
End If
result
variable to reference a text field object on the screen named "screen1".tag1
.tag2
.tag1
and tag2
are equal.tag1
and tag2
) are retrieved and stored in variables."Both Values Are Equal"
."Both Values Are Not Equal"
.
If _condition1 Then
' Executes when condition1 is true
ElseIf _condition2 Then
' Executes when condition1 is false, but condition2 is true
ElseIf _condition3 Then
'Executes when both condition1 and condition2 are false, but condition3 is true
Else
' Executes when none of the above conditions are true
End If
If-Else
) to execute different blocks of code based on their relationship. Below is a breakdown of the code:
value1
and value2
: The script retrieves values from two tags, tag1
and tag2
, using the SmartTags
function. These values will be compared.If value1 = value2
): If value1
is equal to value2
, the message "Both values are equal" is displayed on the screen.ElseIf value1 > value2
): If the first condition is false, the script checks if value1
is greater than value2
. If true, the message "Input 1 is greater than Input 2" is displayed.ElseIf value1 < value2
): If neither of the first two conditions are true, the script checks if value1
is less than value2
. If true, the message "Input 1 is less than Input 2" is shown.Else
): If none of the above conditions are true (although unlikely in this case), the Else
block will be executed, displaying "Unexpected case". This ensures that there is always some feedback displayed.