mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
848ba7303b
FossilOrigin-Name: b5feea667d30aac255d1cfca61fed355d438d2ce6021677f1e53af6302b15eee
25 lines
364 B
Text
Executable file
25 lines
364 B
Text
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
|
|
~~~
|