Command-line arguments: Difference between revisions
Add Prolog
(→Joy: add) |
Mercerenies (talk | contribs) (Add Prolog) |
||
Line 2,075:
Write-Host Argument (++$i) is $s
}</syntaxhighlight>
=={{header|Prolog}}==
The command line arguments supplied to a Prolog interpreter can be accessed by passing <code>os_argv</code> to <code>current_prolog_flag/2</code>.
<syntaxhighlight lang="prolog">:-
current_prolog_flag(os_argv, Args),
write(Args).</syntaxhighlight>
Alternatively, <code>argv</code> can be used to access only the arguments *not* consumed by the Prolog interpreter.
<syntaxhighlight lang="prolog">:-
current_prolog_flag(argv, Args),
write(Args).</syntaxhighlight>
This omits the interpreter name, the input Prolog filename, and any other arguments directed at the Prolog interpreter.
=={{header|Pure}}==
|