# ask-community

Kan Ouivirach

06/06/2022, 10:23 AM
Hi all, I wonder if I could make an op skipped when its input is an empty list? I guess one way is to use conditional branching, but I’d like know if there is an alternative ways?


06/06/2022, 3:13 PM
Checking with the team- I think one option would be to emit None rather than an empty list


06/06/2022, 5:43 PM
conditional branching works when the upstream doesn’t yield, while an empty list would still be considered as an input. if you can control the upstream, i think Johann is right, you can skip emitting an output in the upstream. if you can’t control the upstream, you can do a simple if-else clause to skip running the body of this op so the downstream can still skip, such as:
Copy code
@op(out={"my_normal_workflow": Out(is_required=False)})
def my_op(my_input: list):
  if len(my_input) == 0:
    return # conditional branching of this current op
  # continue with your normal workflow

Kan Ouivirach

06/07/2022, 2:45 AM
Got it. Thanks so much!