Program name: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Add Zig example) |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 78:
<lang aime>o_text(argv(0));
o_byte('\n');</lang>
=={{header|ALGOL 68}}==
<lang>
Line 90 ⟶ 91:
$
</pre>
=={{header|Applesoft BASIC}}==
<lang ApplesoftBASIC>
Line 154 ⟶ 156:
680 RETURN
</lang>
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
Line 213 ⟶ 216:
</lang>
=={{header|AutoHotkey}}==
<lang AutoHotkey>
MsgBox, % A_ScriptName
</lang>
=={{header|AWK}}==
<lang AWK>
Line 422 ⟶ 427:
<pre>Path to executable: C:\Users\kernigh\Documents\field\scratch.exe</pre>
=={{header|C++}}==▼
C++ has difficulty accessing source code filenames, because C code must be compiled into an executable. However, C++ can access the executable's filename.▼
<lang cpp>#include <iostream>▼
using namespace std;▼
int main(int argc, char **argv) {▼
char *program = argv[0];▼
cout << "Program: " << program << endl;▼
return 0;▼
}</lang>▼
=={{header|C sharp|C#}}==
This effectively outputs the executable name, file path, and any arguments for the current program.
Line 467 ⟶ 459:
}
}
▲}</lang>
▲=={{header|C++}}==
▲C++ has difficulty accessing source code filenames, because C code must be compiled into an executable. However, C++ can access the executable's filename.
▲<lang cpp>#include <iostream>
▲using namespace std;
▲int main(int argc, char **argv) {
▲ char *program = argv[0];
▲ cout << "Program: " << program << endl;
▲ return 0;
}</lang>
Line 624 ⟶ 630:
→ "http://www.echolalie.org/echolisp/"
</lang>
=={{header|Elena}}==
ELENA 4.x :
Line 1,117 ⟶ 1,124:
module(..., package.seeall)
end</lang>
=={{header|M2000 Interpreter}}==
<lang M2000 Interpreter>
Line 1,160 ⟶ 1,168:
Print["Program: " <> Program]</lang>
=={{header|Mercury}}==
Line 1,209 ⟶ 1,216:
end
</lang>
=={{header|Nanoquery}}==▼
<lang Nanoquery>println args[1]</lang>▼
{{out}}▼
<pre>programname.nq</pre>▼
=={{header|Nemerle}}==
Line 1,241 ⟶ 1,253:
Program: pn.jar
</pre>
▲=={{header|Nanoquery}}==
▲<lang Nanoquery>println args[1]</lang>
▲{{out}}
▲<pre>programname.nq</pre>
=={{header|newLISP}}==
Line 1,276 ⟶ 1,283:
Program name: ./ProgramName
</pre>
=={{header|Objective-C}}==
Line 1,373 ⟶ 1,381:
<lang Perl>use FindBin;
print "Program name $FindBin::Script\n";</lang>
=={{header|Perl 6}}==▼
{{works with|rakudo|2015-10-16}}▼
In Perl 6, the name of the program being executed is in the special global variable <tt>$*PROGRAM-NAME</tt>.▼
<lang perl6>say $*PROGRAM-NAME;</lang>▼
=={{header|Phix}}==
Line 1,499 ⟶ 1,502:
(module+ main (printf "Program: ~a\n" (program)))</lang>
(formerly Perl 6)
▲{{works with|rakudo|2015-10-16}}
▲In Perl 6, the name of the program being executed is in the special global variable <tt>$*PROGRAM-NAME</tt>.
▲<lang perl6>say $*PROGRAM-NAME;</lang>
=={{header|Raven}}==
Line 1,925 ⟶ 1,934:
Wscript.Echo "FullName:",Wscript.FullName
=={{header|vbscript}}==
Line 1,960 ⟶ 1,970:
appname = fullpath
End If</lang>
=={{header|x86 Assembly}}==
|