Reputation: 103
I have created 3 functions. Each connects to a database, runs a query and displays the result. Run indivually they all work fine. However I want the user to decide which report of 3+ to run, to do so they will select a parameter and hit an execute button. How do I write a nested if then do in Clojure to decide which functions to execute?
If param = "reporta" do execute functiona else if param = "reportb" do execute functionb else etc etc etc
I have searched online but can't really find a good example of what I am trying to do... Any advise much appreciated.
Upvotes: 4
Views: 416
Reputation: 1207
You can use case
for your problem:
(case param
"reporta" (do-something-a)
"reportb" (do-something-b)
(else-case))
Upvotes: 3