The ‘using’ control structure in Beginning Scala (by David Pollak)
In David Pollak's book, Beginning Scala, he introduces a using
control structure that is helpful in several ways. First, it can be used to automatically close any resource that has a close
method. Second, it's a great example of how to create a custom control structure in Scala.
Introduction
Here's the source code for the using
control structure he created: