Conditional Statements
Learn how to write conditional statements in your automations.
Kognitos allows your automation to make decisions based on logic. The keywords if
, then
, and else
help control your automation's behavior in different scenarios, enabling dynamic workflows.
if / then Syntax
The basic syntax for a conditional decision is:
if {condition} then
{do an action}
Example
if the number of team members < 10 then
send "Let's have lunch outside!" to the team members
if / then / else Syntax
To add more flexibility, you can use an else
statement to specify an alternative action when the condition is not met:
if {condition} then
{do an action}
else
{do a different action}
Example
if the number of team members < 10 then
send "Let's have lunch outside!" to the team members
else
send "Meet you in the cafeteria!"
Nested if / then / else statements
You can nest if / then / else statements to add more layers of logic for more complex conditions:
if the partner is "partner a" then
use 0.1 as the rate
else
if the partner is "partner b" then
use 0.2 as the rate
else
use 0.4 as the rate
Don't Forget to Indent
Proper indentation is crucial when writing if / then / else statements, especially when nesting them. It ensures the automation logic is clear, easy to follow, and runs as expected.
Updated about 1 month ago