title: How to stop a conditional statement in racket without using error?
body: <p>I am trying to implement the guess my number game in racket, and in a functional way, for educational purposes. My problem is that I have to stop the function with an error as in <code>(error "YOU GUESSED!")</code>. <a href="http://docs.racket-lang.org/reference/if.html" rel="nofollow noreferrer">The error function is what I could find in the racket documentation</a>. Is there an errorless way to stop this conditional?</p>
  
  <p>Note: I read about <a href="https://stackoverflow.com/q/18668773/664404">stop-when</a>, but I don't want to go into big-bang yet.</p>
  
  <pre><code>(define guess-my-number (lambda ()
    (letrec ([my-number (random 100)]
             [choices-left 7]
             [game (lambda (choices-left)
                  (if (&gt; choices-left 0)
                      (let ([user-guess (read)])
                        (cond [(&gt; user-guess my-number) (display "That was too high!")]
                              [(&lt; user-guess my-number) (display "That was too small!")]
                              [(= user-guess my-number) (error "YOU GUESSED!")])
                      (game (- choices-left 1)))
                      (display "Here ends the game!!")))])
      (game choices-left))))
  </code></pre>