button toggle

i tried removing the 0 value declared at the start, also i tried setting it to a number other than 0 or 1 but the same thing still happens. i guess it is because the way i have designed the code there are only two possible states for it to be.