Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def withPrintWriter(file: String)(op: PrintWriter => Unit) {
val writer = new PrintWriter(file)
try op(writer)
finally writer.close
withPrintWriter("out.txt") { w =>
w.println("anything you want to write")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.