[Coco] replicating bitwise operators in BASIC

Barry Nelson barry.nelson at amobiledevice.com
Fri Sep 9 00:09:40 EDT 2016


The operators AND, OR, and NOT work fine.

Example

PRINT 3 AND 2

outputs 2
and

PRINT 1 OR 2

outputs 3

The XOR operator can be constructed out of AND, OR, and NOT.

> Brett Gordon beretta42 at gmail.com 
> Thu Sep 8 23:54:22 EDT 2016
> BASIC gurus:
> 
> In noodling with Jim's test code for the CoCoNIC, I realized the lack of
> bitwise AND, XOR, OR, etc. in coco BASIC.  What's the orthodox way of
> replicating these operators that are so customary in other languages?  I
> remember loads of head scratching in Lua, which like our BASIC, also lacks
> basic bitwise functions and converts all numbers to floats.
> 
> brett



More information about the Coco mailing list