Program name: Difference between revisions

Add Ecstasy example
(→‎Joy: add)
(Add Ecstasy example)
 
(4 intermediate revisions by 4 users not shown)
Line 351:
 
: _start ( rsp -- noret ) arg0 print-arg bye ;</syntaxhighlight>
 
=={{header|BQN}}==
<syntaxhighlight lang="bqn">•name</syntaxhighlight>
 
=={{header|C}}==
Line 696 ⟶ 699:
→ "http://www.echolalie.org/echolisp/"
</syntaxhighlight>
 
=={{header|Ecstasy}}==
<syntaxhighlight lang="ecstasy">
module WhatIsMyName {
@Inject Console console;
 
void run() {
console.print($"program name: {this:module}");
}
}
</syntaxhighlight>
 
{{out}}
<pre>
program name: WhatIsMyName
</pre>
 
=={{header|Elena}}==
Line 719 ⟶ 738:
 
<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 ⟶ 1,009:
 
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,118:
 
=={{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,125:
{{out}}
<pre>
My name is program_nameProgram_name.wren
</pre>
 
162

edits