Can I set up a case statement to check whether it ...
# ask-community
j
Can I set up a case statement to check whether it is the weekend or a weekday? https://docs.prefect.io/core/idioms/conditional.html . I want to do something like with case(condition, 6 or 7): with the numbers referring to a check_condition that returns the day of the week.
Something like this:
Copy code
@task(name = "Check Day of Week", log_stdout=True, max_retries=3, retry_delay=timedelta(seconds=10))
def daycheck():
    day = datetime.today().weekday()
    return(day)

with flow():
    with case(condition >= 6):
        bla bla
k
You would need an intermediate task that returns True or False for this since case is just for equality
j
Something like this?
k
Yes but I think you can combine the two tasks?
j
ahhh I get it
Thank you!
👍 1