|
Post by sbaker51 on May 5, 2022 1:18:58 GMT
The following example is taken from the book 'Compute's 128 Programmer's Guide' from the code example associated with an explanation of XOR on page 124 of that book. I am hoping that someone might explain the XOR(-A(=2),-(B=3)) part of line 20 in this example.
10 FOR A=1 TO 3;FOR B=1 TO 3 20 PRINT A,B, XOR(-(A=2),-(B=3)),XOR(A,B) 30 NEXT B,A
Thank You
|
|
|
Post by oziphantom on May 5, 2022 17:24:14 GMT
A=2 will return 0 if A is not equal to 2 and -1 when it does.
so (-(A=2)) will be 0, but when A is 2 it will be 1
so basically this does A,B XOR(A==2, B==3), (XOR(A,B)
|
|