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.
Use cond
or condp:
(condp = param
"reporta" (functiona)
"reportb" (functionb)
(function-else))
Alternatively, you could use a map of functions and just index by param.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With