Description
Theif command is used to conditionally execute a set of commands based on whether a specified condition evaluates to true or false. If the condition is true, the commands in the then block are executed. Otherwise, the commands in the else block are executed.
Arguments
Example usage
Protips
- Ensure the
conditionis clearly defined and evaluates correctly to avoid unexpected behavior. - Use descriptive
thenandelseblocks to handle both outcomes effectively.
Gotchas
- The else block is optional, if the
conditionfails and there is noelseblock, the execution will continue from the next available command. - If the
conditionis invalid or can’t be evaluated, the command will fail. - Ensure all commands in the
thenandelseblocks are valid and properly formatted.
The
if command is useful for creating conditional logic in your tests, allowing for more dynamic and flexible workflows.
