I found this bit of code on StackOverflow but I don’t fully understand it. In particular, I don’t understand the use of (do)
. Why is it needed? What if I simply had the println
? Is do
there in case I want to do multiple things?
(.addShutdownHook (Runtime/getRuntime)
(Thread.
#(do (println "ShutdownHook: app is shutting down"))))