DEV Community

Discussion on: Flaws of PHP Iterators

Collapse
 
jung profile image
Jean Jung

I don't know why people hate using exceptions to control flow, I do not have any concerns about it. Not the best thing to do, but with caution it does not harm anyone.
Just a curious fact, I once written a simple Uno game in Java, as an experiment, the game flow was completely controlled by exceptions, but that's a long story. I should write a blog post about it here.

Collapse
 
killertux profile image
Bruno Clemente

The problem with exceptions is that they can lead to inconsistent states. So yeah, you can use it to control flow if you are VERY careful. But I think that almost always there is a better approach.