|Definition||Conditional evaluation of patterns or children elements.|
|Optional Variable Operators Symbols that specify which operations to perform.|
|Occurrence||One or more
The If element controls the generation of responses if certain conditions are met. Usually the conditions are states of predicates/variables or comparison of their values.
Example - SIML Classic
<Model> <Pattern>AM I OLD ENOUGH</Pattern> <Response> <If User="age" Value="18">Yes you are.</If> <ElseIf User="Age" Value="40">you are 40 years old. So definitely yes.</ElseIf > </Response> </Model>
Example - SIML Modern
<Intent> <Expression Value="Am I old enough?"/> <Response> <If User="age" Value="18">Yes you are.</If> <ElseIf User="Age" Value="40">you are 40 years old. So definitely yes.</ElseIf > </Response> </Intent>
Am I old enough?
Yes you are.
The Bot responds Yes you are if and only if the bot had stored the user’s age and it was set to 18. In this example we used User as the entity whose variables/predicates are to be evaluated. You can also use Bot element to compare bot variables.