Order of conditional evaluation
Monkey Forums/Monkey Programming/Order of conditional evaluation
| ||
I forget, does a bitwise AND has precedence over a NOT?Local flags:int=1 If Not flags&4 Print 1 ''does not print Endif If Not (flags&4) Print 2 ''will print endif in any rate, here is the HTML5 conversion, which seems right if the logical NOT has precedence over the bitwise AND:
if((((!((t_flags)!=0))?1:0)&4)!=0){
print("1");
}
if(!((t_flags&4)!=0)){
print("2");
}
MSDN reference seems to be in line with Monkey: http://msdn.microsoft.com/en-us/library/2bxt6kc4(v=vs.71).aspx I guess If flags&4<>0 is best practice? |
| ||
| > I forget, does a bitwise AND has precedence over a Not? Yes. See language/expressions docs - operators are listed in order of precedence. |