Lichen

tests/logical_simple.py

1046:e16d60edc367
5 months ago Paul Boddie Merged changes from the value-replacement branch. value-replacement-generic
     1 def no_temp(a, b):     2     return not (a and b)     3      4 def uses_temp(a, b):     5     return a and b     6      7 def also_uses_temp(a, b):     8     return a or b     9     10 a = 1    11 b = 2    12 c = uses_temp(a, b)    13 print c                             # 2    14     15 d = also_uses_temp(a, b)    16 print d                             # 1    17     18 e = not a    19 print e                             # False    20     21 f = 0    22     23 g = no_temp(a, b)    24 print g                             # False    25     26 if a and b:    27     print "a and b"                 # a and b    28 else:    29     print "! (a and b)"    30     31 if a and f:    32     print "a and f"    33 else:    34     print "! (a and f)"             # ! (a and f)    35     36 if not (a and b):    37     print "not (a and b)"    38 else:    39     print "! (not (a and b))"       # ! (not (a and b))    40     41 if not not (a and b):    42     print "not not (a and b)"       # not not (a and b)    43 else:    44     print "! (not not (a and b))"    45     46 if a or b:    47     print "a or b"                  # a or b    48 else:    49     print "! (a or b)"    50     51 if not (a or b):    52     print "not (a or b)"    53 else:    54     print "! (not (a or b))"        # ! (not (a or b))    55     56 if not not (a or b):    57     print "not not (a or b)"        # not not (a or b)    58 else:    59     print "! (not not (a or b))"    60     61 if a and b or f:    62     print "a and b or f"            # a and b or f    63 else:    64     print "! (a and b or f)"