retroforth/example/Echo.forth
crc b1ac8cc7a3 update binary names in the examples
FossilOrigin-Name: 83176a62eb4acecad5cad6c2ecae921634f62a52df9dce86664bf526dce0079f
2019-02-03 03:39:34 +00:00

25 lines
364 B
Forth
Executable file

#!/usr/bin/env retro
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
~~~