SEANK.H.LIAO

short circuit logic

short circuits instead of if/else

short circuit

Sometimes you are handed the hammer that is && and ||, and no proper if/else.

if...else

1if x:
2  a
3else:
4  b
1(x && (a || true)) || b

if...else if...else

1if x:
2  a
3else if y:
4  b
5else:
6  c
1(x && (a || true)) || (y && (b || true)) || c

nested if

1if x:
2  if y:
3    a
4  else:
5    b
6else:
7  b
1(x && (y && (a || true) || (b || true))) || c