255 byte value...
BlitzMax Forums/BlitzMax Programming/255 byte value...
| ||
Local r:Byte = 0 If Not r = 255 Then Print "ok with not" If r <> 255 Then Print "ok with <>" Here I get only : ok with <> Am I missing something or I am the only one with this result? |
| ||
HiLocal r:Byte = 0 If Not (r = 255) Then Print "ok with not" If r <> 255 Then Print "ok with <>" A bug? I don't know. Mfg Suco |
| ||
Ok, the B3D Version Local r=0 If Not r = 255 Then Print "ok with not" If r <> 255 Then Print "ok with <>" WaitKey() Runs fine. "ok with not" "ok with <>" Mfg Suco |
| ||
B3D isn't BM. BM has seperated operators for bitoperation and boolean comparision and a "deeper" knowledge of data types then B3D had. You operation does simply: not 0 ie not false -> true = 1 For what you want to do, you would need to use the bitwise XOR Local r:Byte = 0 If ($FF ~ r) = 255 Then Print "ok with not" If r <> 255 Then Print "ok with <>" $FF ~ r reverts all bits of the byte |
| ||
So I was missing something. Still a bit confusing but it's good to know that the problem was me. |
| ||
Hi, The operator precedence of 'Not' is different in BMX from B3D - use: If Not (r = 255) Then Print "ok with not" |