Skip to content

Instantly share code, notes, and snippets.

@jprudent
Last active September 22, 2022 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jprudent/bc8e321c563680d46c60ca970b0804f9 to your computer and use it in GitHub Desktop.
Save jprudent/bc8e321c563680d46c60ca970b0804f9 to your computer and use it in GitHub Desktop.
Functions (clojure) example
;; no arguments
(fn [] (println "Hello"))
;; one argument
(fn [s] (println s))
;; two arguments
(fn [x y] (+ x y))
;; with type hint
(fn [^Integer x ^Integer y] (+ x y))
;; multiple statements
(fn [x y]
(println x)
(println y)
(+ x y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment