tFalse = 0 tDontKnow = 1 tTrue = 2 sub not3(b) return 2-b end sub sub and3(a,b) return min(a,b) end sub sub or3(a,b) return max(a,b) end sub sub eq3(a,b) if a = tDontKnow or b = tDontKnow then return tDontKnow elsif a = b then return tTrue else return tFalse end if end sub sub xor3(a,b) return not3(eq3(a,b)) end sub sub shortName3$(i) return mid$("F?T", i+1, 1) end sub sub longName3$(i) switch i case 1 return "Don't know" case 2 return "True" default return "False" end switch end sub print "Nombres cortos y largos para valores logicos ternarios:" for i = tFalse to tTrue print shortName3$(i), " ", longName3$(i) next i print print "Funciones de parametro unico" print "x", " ", "=x", " ", "not(x)" for i = tFalse to tTrue print shortName3$(i), " ", shortName3$(i), " ", shortName3$(not3(i)) next i print print "Funciones de doble parametro" print "x"," ","y"," ","x AND y"," ","x OR y"," ","x EQ y"," ","x XOR y" for a = tFalse to tTrue for b = tFalse to tTrue print shortName3$(a), " ", shortName3$(b), " "; print shortName3$(and3(a,b)), " ", shortName3$(or3(a,b)), " "; print shortName3$(eq3(a,b)), " ", shortName3$(xor3(a,b)) next b next a end