Command-line arguments: Difference between revisions
Content added Content deleted
Line 198: | Line 198: | ||
exit(0) |
exit(0) |
||
</lang> |
</lang> |
||
VERSION 3: |
|||
etc... |
|||
<lang Amazing Hopper> |
|||
#include <hopper.h> |
|||
main(argv, argc) |
|||
i=2 |
|||
#hl{ |
|||
print( "This program named: ",argv[1],"\n") |
|||
while( i <= argc ) |
|||
print("Argument #",i," = ",argv[i],"\n") |
|||
i += 1 |
|||
wend |
|||
} |
|||
exit(0) |
|||
</lang> |
|||
VERSION 4: |
|||
<lang Amazing Hopper> |
|||
#include <natural.h> |
|||
#include <hopper.h> |
|||
main: |
|||
get total arguments, and remember as (argc). |
|||
remember ("This program named: "), |
|||
remember ( argument (1) ), and print with a new line. |
|||
secondly, i=2, |
|||
do while ( variable (i) is less than (argc), \ |
|||
consider this ( {"Argument #",i," = "} );\ |
|||
remember ( argument (i) ) and print with a new line; finally ++i ) |
|||
exit(0) |
|||
</lang> |
|||
ETCETERA... |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |