In this guide, we will discuss Functions with Multiple Arguments in Clojure. Clojure functions can be defined with zero or more parameters. The values you pass to functions are called arguments, and the arguments can be of any type. The number of parameters is the function’s arity. This chapter discusses some function definitions with different arities.
In the following example, the function demo is defined with multiple arguments for each function definition.
(defn demo [] (* 2 2)) (defn demo [x] (* 2 x)) (defn demo [x y] (* 2 x y))
In the above example, the first function definition is a 0-arity function, since it has 0 arguements, one-param is 1-arity, and two-params is 2-arity and so on.
Next Topic : Click Here
Pingback: Clojure - Anonymous Functions | Adglob Infosystem Pvt Ltd
Pingback: Clojure - Functions | Adglob Infosystem Pvt Ltd