You can use routines to achieve similar results.
Here is an example:
More complex scenarios can be achieved using Sharptools.