Clojure Finally块

(ns clojure.examples.example
   (:gen-class))
(defn Example []
   (try
      (def string1 (slurp "Example.txt"))
      (println string1)

      (catch java.io.FileNotFoundException e (println (str "caught file
         exception: " (.getMessage e))))

      (catch Exception e (println (str "caught exception: " (.getMessage e))))
      (finally (println "This is our final block")))
   (println "Let's move on"))
(Example)

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/265661.html

(0)
上一篇 2022年6月7日 20:43
下一篇 2022年6月7日 20:43

相关推荐

发表回复

登录后才能评论