Why == works in an if statement?

Krupski:
print ("It matches!"); <-- this gets printed because setting X to anything returns boolean "true"

Make sense?

No.
Setting X to any non-zero value returns a boolean true
Setting X to zero returns a boolean false