Program name: Difference between revisions

m
(→‎Joy: add)
m (→‎{{header|Wren}}: Minor tidy)
(3 intermediate revisions by 3 users not shown)
Line 351:
 
: _start ( rsp -- noret ) arg0 print-arg bye ;</syntaxhighlight>
 
=={{header|BQN}}==
<syntaxhighlight lang="bqn">•name</syntaxhighlight>
 
=={{header|C}}==
Line 719 ⟶ 722:
 
<code>load-file-name</code> is the ".el" or ".elc" currently being loaded. Within a batch <code>-l</code> it will be the script name, but within sub-loads like <code>require</code> etc it is that sub-load.
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
writeLine("path: " + Runtime.path)
writeLine("name: " + Runtime.name)
writeLine("args: " + Runtime.args)
</syntaxhighlight>
{{out}}
<pre>
emal.exe Org\RosettaCode\ProgramName.emal sample arguments
path: C:\tmp\Org\RosettaCode\ProgramName.emal
name: ProgramName.emal
args: [sample,arguments]
</pre>
 
=={{header|Erlang}}==
Line 976 ⟶ 993:
 
exit ''</syntaxhighlight>
 
=={{header|Jakt}}==
The name of the program is stored in the first index of the array passed to main. This is the name of the compiled executable, so when using jakt -cr the value will be a path starting with build/.
 
<syntaxhighlight lang="jakt">
fn main(arguments: [String]) {
let program_name = arguments[0]
println("{}", program_name)
}
</syntaxhighlight>
 
=={{header|Java}}==
Line 2,075 ⟶ 2,102:
 
=={{header|Wren}}==
Assuming we're running a script file named "program_nameProgram_name.wren":
<syntaxhighlight lang="ecmascriptwren">import "os" for Process
 
System.print("My name is %(Process.allArguments[1])")</syntaxhighlight>
Line 2,082 ⟶ 2,109:
{{out}}
<pre>
My name is program_nameProgram_name.wren
</pre>
 
9,485

edits