autoqasm.operators.conditional_expressions module
Operators for conditional expressions (e.g. the ternary if statement).
- autoqasm.operators.conditional_expressions.if_exp(cond: Any, if_true: Callable[[], Any], if_false: Callable[[], Any], expr_repr: str | None) Any[source]
Implements a conditional if expression.
- Parameters:
cond (Any) – The condition of the if clause.
if_true (Callable[[], Any]) – The function to run if the condition is true.
if_false (Callable[[], Any]) – The function to run if the condition is false.
expr_repr (str | None) – The conditional expression represented as a string.
- Returns:
Any – The value returned from the conditional expression.