CodeSOD: Exceptional Assignment

This post was originally published on this site

The Daily WTF

Ellen sends us a very simple WTF today, that she found in production code.

bool condition; try { condition = true; } catch { condition = false; }

It’s true, there isn’t much to say about this exceptional code block. But if assigning a boolean to a boolean variable ever fails, we’re prepared to handle it.

To read the full article click on the 'post' link at the top.