Boolean code block

I found the following forum post that answers my question with a couple of different methods.