A molecular triad consisting of a porphyrin (P) covalently linked to two photochromes-one from the dihydroindolizine family (DHI) and one from the dihydropyrene family (DHP)-has been synthesized and found to act as either a molecular AND logic gate or an INHIBIT gate, depending on the inputs and initial state of the photochromes. The basis of these functions is quenching of porphyrin fluorescence (output of the gates) by the photochromes. The spiro form of DHI does not quench porphyrin fluorescence, whereas its betaine isomer strongly quenches by photoinduced electron transfer. DHP also quenches porphyrin fluorescence, but its cyclophanediene isomer does not. The triad has been designed using suitable energetics and electronic interactions, so that although these quenching phenomena may be observed, independent isomerization of the attached photochromes still occurs. This makes it possible to switch porphyrin fluorescence on or off by isomerization of the photochromes using various combinations of inputs such as UV light, red light, and heat.