Hello! Even at the very beginning of the study Clojure. Tell me please.
I have a clojure project. I use the hiccup templating engine and Bootstrap styles. Everything is working. But I just don’t understand how the conditional operators work in my case.
Here is my code:
Project.clj file :
(defproject yupppie "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "ссылка (ссылка словом потому что не позволяет репутация вставлять)" :license {:name "Eclipse Public License" :url "ссылка"} :dependencies [[org.clojure/clojure "1.7.0"] [ring "1.4.0"] [compojure "1.4.0"] [hiccup "1.0.5"]] :plugins [[lein-ring "0.9.7"]] :ring {:handler yupppie.core/app}) Yupppie.core file:
(ns yupppie.core (:require [compojure.core :refer :all] [compojure.route :as route] [ring.middleware.params :refer [wrap-params]] [clojure.pprint :refer :all] [hiccup.core :refer :all] [hiccup.page :refer [include-css include-js]])) (defn home [] (html [:head (include-css "/bootstrap-3.3.6-dist/css/bootstrap.min.css") (include-css "/styles.css") (include-css "https://fonts.googleapis.com/icon?family=Material+Icons") (include-js "/bootstrap-3.3.6-dist/js/bootstrap.min.js")] [:body [:div {:class "col-lg-6"} [:div {:class "input-group"} [:input {:type "text" :class "form-control" :placeholder "How old are you?"} [:span {:class "input-group-btn"} [:button {:class "btn btn-default" :type=" button"} "Go, baby!"]]]]]])) ; (defroutes app (route/resources "/") (GET "/" [] (home)) (POST "/saveform" req (with-out-str (clojure.pprint/pprint (:params req))))) (def apps (wrap-params app)) I began to study it recently, so I don’t really understand it.
I have a simple form. And when you enter in the field a digit less than 18 and press a button, you need to make it so that one picture is shown, and when you enter a digit 18 or more, another picture. Here's how I use the conditional if statement to make it work? Where to insert the code and what to write?