So if debounce == false then and if not debounce then functions the same. Are there are actually the same? Because when using it with the if statement. They work same.
Is not and false are the same?
2 answers
When you say
if debounce == false then
You are actually checking if the value of debounce is false. This statement will then return true if you set debounce = false.
On the other hand,
if not debounce then
will return true if (not debounce) is true. not is an logic operator that will return the opposite value - so not true will return false and not false will return true.
This statement is different than the previous one. Say we choose the value of debounce to be nil, then saying if not debounce then will actually work, and the if statement will run. This is because when using the not operator on nil, Lua will read the statement as true if used inside of an if statement. However if you check nil == false, that statement is false, but (not nil) == true returns true.
Hope this helps.
3 comments
Why are some people so good at explaining things. XD
Thanks but you mean when local Debounce = false but you used if not debounce then, it is true?
yes in the context of if then statements.
Using not in front of a bool reverses the bool value.
If the debounce is true and you do not debounce
Then the debounce will = false
if the debounce is false and you do not debounce
Then the debounce = true
3 comments
If you do if not debounce then it always means if debounce == false.
yes but in the context of if then's I was jumping to the conclusion. not deb will pass as true when deb is false and not deb will pass as false when deb is true.
i mean with my debounce scripts, that's how i've seen the logic. it always runs only when false
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I guess they do(Only for a bool value because theres only true and false!!) because you could do if debounce == not true or you could use if debounce == false or for short you could do if debounce ~= true which means not true for short
In a way not and false are the same, but you can't do false false or false true in coding and have to use not true or not false.