.. getthecode:: conditional.py :language: python3 :hidden: ========================= Conditional Expressions ========================= This page contains a memo on conditional expressions. The syntax of a If statement is: .. code-block:: py3 if something_is_true: # do something pass else: # do something else pass Conditional expressions provides a shorter syntax: .. code-block:: py3 result = 'foo' if something_is_true else 'bar'