0.24 Getting a number from the keyboard

Let's start with "you're not supposed to understand this". If you dig deeper in 4tH you'll find out why it works the way it works. But if you define this word in your program it will read a number from the keyboard and put it on the stack. If you haven't entered a valid number, it will prompt you again. By the way, this is the end of the first level. Take our advise and give it a try!

:    input#                             ( -- n)
          refill drop bl word number         ( n)
          dup (error) <>                ( n f)
          dup 0=                        ( n f -f)
          if swap drop then             ( f ¦ n f)
     until ;