Thanks a whole lot! The Docs really need to get better by showing clear examples like this for just about everything. It took way too long for me to search and not even find this, and had to resort to asking how to do this here. I also agree the semantics for doing this has to become a lot shorter/simpler/clearer.
I don't mean to go off, but outputting is such a standard thing to do in any language it should be readily available in the Docs to show users how to deal with the various cases. Thanks again.