[comp.lang.forth] C or Forth

wmb@MITCH.ENG.SUN.COM (Mitch Bradley) (08/19/90)

>  3. Write a program that repeatedly calculates how many chars separate
>  two letters typed in by the user, until terminated with ctlC.

: getchar  ( -- char )  key dup emit   dup  3 =  abort" "  ;
: distance  ( -- )  getchar getchar - abs 1+  . cr  ;
: go  ( -- )  begin  ." Enter 2 characters: " distance  again  ;

That was too easy; am I missing something?

Mitch