Why == works in an if statement?

this gets printed because setting X to anything returns boolean "true"

sp. "this gets printed because setting X to any non-zero value returns boolean "true"