retroforth/example/Echo.forth
crc 73493f92f4 complete renaming of words in the examples
FossilOrigin-Name: c9ea59275146e3ccddbcfc3c8e2aa12e0c1f51f6d54c9674cf7d9a3b0500bf7c
2018-05-07 16:36:37 +00:00

25 lines
362 B
Forth
Executable file

#!/usr/bin/env rre
This is a simple `echo` style example.
~~~
#0 sys:argc
~~~
Then a simple loop:
- duplicate the argument number
- get the argument as a string
- display it, followed by a space
- increment the argument number
~~~
[ dup sys:argv s:put sp n:inc ] times
~~~
And at the end, discard the argument number and inject a
newline.
~~~
drop nl
~~~