Your second code snippet is probably correct. It looks bad to use == 1 instead of true. At least it fails to compile. If you go through my posts and look for == true or == false, you will find out that it is redundant and error‑prone. Miss out the = 1 or == 1 altogether.
Something must be done about this. Let's start by reading this tiny ad: