Create a function that gives a personalized greeting. This function takes two parameters: name and owner.
Use conditionals to return the proper message:
case | return |
---|---|
name equals owner | Hello boss |
otherwise | Hello guest |
當名字是擁有者時,回傳字串Hello boss
; 不是擁有者時回傳 Hello guest
(ns kata)
(defn greet [name_ owner]
(cond
(= name_ owner) "Hello boss"
:else "Hello guest")
)
(ns kata)
(defn greet [name_ owner]
(if (= name_ owner) "Hello boss" "Hello guest")
)