Can you give details about what you're trying to do? What you are describing could be almost anything.
The basic idea is that, if you can't avoid the `do-some-thing` procedure being non-functional, then you hope that, at least, it frobs a variable that you can see in your caller; then, you can just check that. A general example of this setup is checking for EOF when in a loop reading from a file.
But if you can avoid such a situation, it's better to design something functional.