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


Gforth Manual

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

3.4 Stack

The most obvious feature of Forth is the stack. When you type in a number, it is pushed on the stack. You can display the content of the stack with .s.

 
1 2 .s
3 .s

.s displays the top-of-stack to the right, i.e., the numbers appear in .s output as they appeared in the input.

You can print the top of stack element with ..

 
1 2 3 . . .

In general, words consume their stack arguments (.s is an exception).

Assignment:
What does the stack contain after 5 6 7 .?


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