Nothing’s wrong with the code, but the `do` inside the catch form is unnecessary. Also, this won’t always convert to a float. Consider using Float/parseFloat, e.g., (Float/parseFloat “3.0”)
> On Aug 13, 2014, at 3:31 PM, sindhu hosamane <sindh...@gmail.com> wrote: > > (defn convert-to-float [a] > (try > (if (not= a " ") > (read-string a)) > (catch Exception e (do > nil)))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.