Added an example using when.#
Merge pull request #195 from arlando/feature-when-example

Added an example using when.