Boolean expression determining which branch to execute.
Typically evaluates business conditions like user roles, feature flags, data states, or validation results. Should represent meaningful business logic rather than arbitrary technical conditions.
Examples:
Optional
elseOptional alternative block for when condition is false.
Can be another IIfStatement for chained conditions (else-if) or IBlock for alternative business flow. May be null when no alternative action is needed.
Business context: Represents fallback behavior, alternative user journeys, or error handling paths.
Block to execute when condition is true.
Contains the primary business flow for the conditional scenario. Should represent the main path or expected behavior when the business condition is met.
Type discriminator.
Conditional statement for business rule-based test flow control.
Enables test scenarios to branch based on runtime conditions or business rules. This should be used for genuine business logic branching where different test paths are needed based on data state or business conditions.
IMPORTANT: For validation purposes, prefer predicate expressions instead:
IEqualPredicate
instead ofif (x === y) throw new Error(...)
INotEqualPredicate
instead ofif (x !== y) throw new Error(...)
IConditionalPredicate
instead ofif (!condition) throw new Error(...)
IErrorPredicate
instead ofif
blocks that only contain error throwingOnly use IIfStatement when:
Business scenarios requiring conditional logic:
AI function calling strategy: First consider if the validation can be handled by predicate expressions. Use IIfStatement only when genuine business logic branching is required that cannot be expressed through predicates.