I have an API call which returns a list of bookings. If there are 0 bookings, we use Path B. Otherwise if there is data - I have Path A which uses data received from an API call and loops over that data. I only want to see bookings where the user has not cancelled (and thus needs to be completed) so I have added a filter to check the booking status. For these bookings I add a detailed calendar event.
However, if all bookings that were returned by my api call are the incorrect status type I need to create another detailed calendar event. I therefore need to break out of the loop or somehow continue if my filter never passes in any iteration of the loop.
If I add a filter at the end of the loop as advised in other threads, it will of course never be run. How can I break out of this loop?




