open:defining-a-function

Defining a Function

(defn functionname
   “optional documentation string”
   [arguments]
   (code block))

(ns clojure.examples.hello
   (:gen-class))

;; This program displays Hello World
(defn Example []
   (def x 1)
   (def y 1.25)
   (def str1 "Hello")
   (println x)
   (println y)
   (println str1))
   
(Example)

Output

1
1.25
Hello

  • open/defining-a-function.txt
  • Last modified: 2024/10/05 06:15
  • by 127.0.0.1