Added `when` DSL function.

closes #15