Using the bool function to monitor led

Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Describe what the code actually does and how that differs from what you want.

What does that mean?