Quick `conditional` question. Is there a way to re...
# ask-the-community
a
Quick
conditional
question. Is there a way to resolve a result from a conditional, but only if its true? Something like this:
Copy code
result = ""
result = conditional("cond").if_(<conditional statement>).then(run_task()).else_().then(result)
Obviously this is a bit contrived, but is there a way to use a conditional like a single if, rather than having to run a different task if its not true? If that makes sense
s
is this what you're referring to? https://github.com/flyteorg/flyte/issues/3533
a
Yes, it looks like it. But I would also love to be able to assign the result of the conditional to a variable, so that when the
else_
runs, it can assign the variable a default value, if that makes sense. So a task would only run if the condition is true, and if the task doesn’t run, the output of the conditional could be a default value