Next: , Previous: Compared assigning, Up: Comparison


5.2 Conditionals

C:

     if ((a == 2 && b < 5) || (c != 4 && !d)) do_something();

Python:

     if (a == 2 and b < 5) or (c != 4 and not d):
     do_something()

Enigma:

     a 2 ! equal = cond-a;
     b 5 ! lesser = cond-b;
     c 4 ! equal ! not = cond-c;
     d ! not = cond-d;
     cond-a cond-b ! and = ncond-ab;
     cond-c cond-d ! and = ncond-cd;
     ncond-ab ncond-cd ! or = actcond;
     actcond do-something ! act;