# Stillness in Motion - Clojure

Can someone help me out with this one? It seemed completely straight forward but I’ve rewritten it in a handful of ways and it won’t work at all. In this one I litterally just fille din the blanks, and still no luck.

``````;; You can put one if-statement within another if-statement.
;; However, doing so can be tricky, so you have to pay close attention to how the if statements interact with each other.
;; Make sure the indentation is correct!
(dotimes [n 1000]
(let [enemy (.findNearestEnemy this)]
;; If there is an enemy, then...
(if enemy
(do
;; Create a distance variable with distanceTo.
(def distance (.distanceTo this enemy))
;; If the enemy is less than 5 meters away, then attack()
(if (< distance 5)
(.attack this enemy)
;; Otherwise (the enemy is far away), then shield()
(.shield this)
)
)
;; Otherwise (there is no enemy...)
;; ... then move back to the X.
(.moveXY this 40 34)
)
)
)
``````

Here’s a rewrite

``````(dotimes [n 1000]
(def enemy (.findNearestEnemy this))
(if enemy
(do
(if (< (.distanceTo this enemy) 5)
(.attack this enemy)
(.shield this)
)
)
(.moveXY this 40 34)
)
)
``````

This code did work:

``````(dotimes [n 1000]
(def enemy (.findNearestEnemy this))
(if enemy (if (< (.distanceTo this enemy) 5) (.attack this enemy)))
(.moveXY this 40 34)
)
``````

And I guess for that matter so did

``````(dotimes [n 1000]
(if (.isReady this "cleave") (.cleave this (.findNearestEnemy this)))
(.moveXY this 40 34)
)
``````

On a side note this editor keeps giving me a blank screen when I hit ctrl+k and it submitted the form when I hit enter for new line…