How do I execute if there are no non-player mobs in an area? [duplicate]

I am attempting to create a wave survival game, in which zombies and other mobs are fought and killed until there are none left, and another wave is started right after their deaths. I cannot figure out how to use the execute command to test whether or not zombies (non-player mobs) are in the area or are still alive to begin wave two.


Solution 1:

That's exactly what /execute unless entity is for:

/execute unless entity @e[type=zombie,distance=..10] run <command>