if statement with ! before variable
This question already has an answer here:
! is the plan language equivalent of 'not'. it is the shorthand way of saying if (boolval != true), notice the ! in != also means not as in not equal. So the section of code you posted pretty much just says if the timer is NOT active, activate it.
The 0 is converted to false before ! logically negates it, producing true.
if(x)
means "if x
is true
"
if(!x)
means "if not x
is true
", which is the same thing as "if x
is false
"
上一篇: 按位操作布尔值
下一篇: 如果声明与! 变量之前