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
  • 마지막으로 수정됨: 2021/11/22 23:47
  • 저자 127.0.0.1