www.delorie.com/gnu/docs/gforth/gforth_140.html   search  
 
Buy GNU books!


Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.18.4 Displaying characters and strings

This section starts with a glossary of Forth words and ends with a set of examples.

doc-bl doc-space doc-spaces doc-emit doc-toupper doc-." doc-.( doc-type doc-typewhite doc-cr doc-at-xy doc-page doc-s" doc-c" doc-char doc-[char]

As an example, consider the following text, stored in a file `test.fs':

 
.( text-1)
: my-word
  ." text-2" cr
  .( text-3)
;

." text-4"

: my-char
  [char] ALPHABET emit
  char emit
;

When you load this code into Gforth, the following output is generated:

 
include test.fs RET text-1text-3text-4 ok

Here are some examples of executing my-word and my-char:

 
my-word RET text-2
 ok
my-char fred RET Af ok
my-char jim RET Aj ok


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003