Stream example
Factor handbook » Input and output » Streams

Next:Stream protocol


Ask the user for their age, and print it back:
USING: io math.parser ; : ask-age ( -- ) "How old are you?" print ; : read-age ( -- n ) readln string>number ; : print-age ( n -- ) "You are " write number>string write " years old." print ; : example ( -- ) ask-age read-age print-age ; example