You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there isn't a boolean negation operator. Both negation operators that are currently defined (! and not) compile to an op flip/not instruction (the operator is called "flip" in GUI and "not" in Mindustry "assembly" language), which produces bitwise negation. This means that the following code
while not switch1.enabled
print("Press the button to start...")
printflush(message1)
end
won't work (switch1.enabled produces 1 when the button is pressed, and bitwise negation makes it into -2).
I propose creating a new unary operator ~ for bitwise negation, and repurposing both ! and not for boolean negation. However, this change could break existing code. @francois, shall I do this?
The text was updated successfully, but these errors were encountered:
Currently, there isn't a boolean negation operator. Both negation operators that are currently defined (
!
andnot
) compile to anop flip/not
instruction (the operator is called "flip" in GUI and "not" in Mindustry "assembly" language), which produces bitwise negation. This means that the following codewon't work (switch1.enabled produces 1 when the button is pressed, and bitwise negation makes it into -2).
I propose creating a new unary operator
~
for bitwise negation, and repurposing both!
andnot
for boolean negation. However, this change could break existing code. @francois, shall I do this?The text was updated successfully, but these errors were encountered: