# Guessing Game Error

**URL:** https://racket.discourse.group/t/guessing-game-error/3784
**Category:** Questions & Answers
**Tags:** question
**Created:** [June 10, 2025, 8:57pm UTC](https://racket.discourse.group/t/guessing-game-error/3784 "2025-06-10T20:57:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![avrame](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/avrame/32/2340_2.png) [@avrame](https://racket.discourse.group/u/avrame)
#### Post date: [June 10, 2025, 8:57pm UTC](https://racket.discourse.group/t/guessing-game-error/3784/1 "2025-06-10T20:57:30Z")

</div>

I read through most of the Racket Guide and decided to write a simple guessing game to test my understanding of Racket. It works for the most part, but once the user guesses the correct answer, I get this error message: `application: not a procedure; expected a procedure that can be applied to arguments given: #<void>`  
Here is my code:

```scheme
#lang racket

(let ([my-num (random 100)])
  (display "I'm thinking of a number between 1 and 100. Please enter your guess below.\n")
  (define (next-round num-rounds)
    (define guess (string->number (read-line)))
    (cond
      [(< guess my-num) (
                         (display "Too low, try again!\n")
                         (next-round (+ num-rounds 1)))]
      [(> guess my-num) (
                         (display "Too high, try again!\n")
                         (next-round (+ num-rounds 1)))]
      [else (display (string-append "You guessed it in " (number->string num-rounds) " guesses!"))]))
  (next-round 1))

```

---

<div class="post-metadata">

### Author: ![shawnw](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/shawnw/32/1031_2.png) [@shawnw](https://racket.discourse.group/u/shawnw)
#### Post date: [June 10, 2025, 9:55pm UTC](https://racket.discourse.group/t/guessing-game-error/3784/2 "2025-06-10T21:55:18Z")

</div>

> [@avrame](#):
>
> ```scheme
> ( ; <-- the offender
> (display "Too low, try again!\n")
> (next-round (+ num-rounds 1)))
> 
> ```

This tries to call the function returned by calling `display` with one argument, whatever `next-round` returns. Since `display` doesn't return a function, it fails. Got to pay attention to your parenthesis and not add extraneous ones.

---

<div class="post-metadata">

### Author: ![avrame](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/avrame/32/2340_2.png) [@avrame](https://racket.discourse.group/u/avrame)
#### Post date: [June 10, 2025, 10:32pm UTC](https://racket.discourse.group/t/guessing-game-error/3784/3 "2025-06-10T22:32:55Z")

</div>

Ah, I see - thank you
