A heteroditopic BODIPY dye that performs all basic Boolean operations with a cation (K+) and an anion (F-) as inputs and absorption, transmission and fluorescence as outputs is described. The molecular logic gate can also act as a digital comparator between the inputs.