Hello world/Newbie: Difference between revisions

m
syntax highlighting fixup automation
m (→‎{{header|J}}: adapt to newer versions, and match Hello_world/Text#J)
m (syntax highlighting fixup automation)
Line 56:
execute it : helloword64
</pre>
<syntaxhighlight lang="aarch64 assembly">
<lang AArch64 Assembly>
/* ARM assembly Raspberry PI */
/* program helloword64.s */
Line 76:
qAdrMessage: .quad szMessage
 
</syntaxhighlight>
</lang>
 
=={{header|Ada}}==
Line 186:
The IDE window will open. Within the list of files in the SRC directory you will find one file already created named "main.adb". This file will already be tagged as a compilation main file. The contents of the initial main.adb file will be:
 
<langsyntaxhighlight Adalang="ada">procedure Main is
 
begin
-- Insert code here.
null;
end Main;</langsyntaxhighlight>
 
Simply edit this file for simple programs or add additional files if you are creating your own Ada packages. This file can be edited to create the Ada hello-world program:
<langsyntaxhighlight Adalang="ada">with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
Put_Line("Hello World!");
end Main;</langsyntaxhighlight>
 
=={{header|ALGOL 68}}==
Line 211:
3. Use your favorite [[Editor|text editor]].
 
3. Open the text editor and type the following: <langsyntaxhighlight lang="algol68">main: (
printf($"Goodbye, World!"l$)
)</langsyntaxhighlight>
 
4. Save the file with the extension .a68.
Line 228:
Although Agda developers suggest using [https://en.wikipedia.org/wiki/Emacs Emacs], this tutorial does not assume having Emacs installed.
 
# Install [https://en.wikipedia.org/wiki/Cabal_(software) Cabal]. On Linux run: <syntaxhighlight lang ="bash">sudo apt install cabal-install</langsyntaxhighlight>
# From the command line, execute: <syntaxhighlight lang ="bash">cabal update</langsyntaxhighlight> which outputs ''Downloading the latest package list from hackage.haskell.org''
# Install Agda with: <syntaxhighlight lang ="bash">cabal install Agda</langsyntaxhighlight> This downloads the packages and then outputs ''Building Agda-2.6.2''. The building process can take several minutes.
# After that, Cabal creates two binaries. On Linux these are <pre>~/.cabal/bin/agda</pre> and <pre>~/.cabal/bin/agda-mode</pre> Make those binaries reachable by the ''PATH'' variable.
# Create the file ''helloworld.agda'' with any editor and paste this snippet: <langsyntaxhighlight lang="agda">module helloworld where
 
open import Agda.Builtin.IO using (IO)
Line 244:
main : IO Unit
main = putStrLn "Hello world!"
</langsyntaxhighlight> (Note that "⊤" is not a capital T, but the [https://en.wikipedia.org/wiki/Tee_(symbol) top symbol]).
# Run <syntaxhighlight lang ="bash">agda --compile helloworld.agda</langsyntaxhighlight> This creates the binary ''helloworld''
# Execute the binary. For example, on Linux run <syntaxhighlight lang ="bash">./helloworld</langsyntaxhighlight> The execution outputs ''Hello world!''
=={{header|Applesoft BASIC}}==
Installation and text editors are not needed. https://rosettacode.org/wiki/Interactive_programming_(repl)#Applesoft_BASIC
Line 255:
</pre>
Start coding ...
<langsyntaxhighlight lang="gwbasic">? "HELLO, WORLD!"</langsyntaxhighlight>
https://archive.org/details/The_Applesoft_Tutorial_HQ_color/
=={{header|ARM Assembly}}==
Line 267:
</pre>
 
<syntaxhighlight lang="arm assembly">
<lang ARM Assembly>
/* ARM assembly Raspberry PI */
/* program helloword.s */
Line 286:
swi 0
iAdrMessage: .int szMessage
</syntaxhighlight>
</lang>
 
=={{header|Arturo}}==
Line 294:
2. Use your favorite [[Editor|text editor]]. Arturo comes with [https://github.com/arturo-lang/arturo#editors--ides support for many popular ones].
 
3. Open the text editor and type the following: <langsyntaxhighlight lang="rebol">
print "Hello World!!"
</syntaxhighlight>
</lang>
 
4. Save the file as <code>hello.art</code>
Line 320:
2) Download and install the [http://fincs.ahk4.net/scite4ahk/ SciTE4AutoHotkey] editor (recommended), or use your favorite [[Editor|texteditor]].
 
3) Open the text editor and type the following: <syntaxhighlight lang AutoHotkey="autohotkey">MsgBox, Hello World!</langsyntaxhighlight>
 
4) Save the file with the extension .ahk.
Line 382:
 
Where hello.awk contains
<langsyntaxhighlight lang="awk">BEGIN {
print "Hello" 3-1 "U", sprintf("%c",33)
} </langsyntaxhighlight>
{{Out}}
Hello2U !
Line 400:
Next, follow the instructions below in the [[#TI-83_BASIC|TI-83 BASIC]] section to create a sample program named MYPROGRM. The contents of the program should be:
 
<langsyntaxhighlight lang="axe">PROGRAM:MYPROGRM
:.HELLO
:Disp "HELLO, WORLD!",i</langsyntaxhighlight>
 
Note that the first line contains the name of the program to be compiled. Also note that the i is the imaginary symbol, not the lowercase letter.
Line 417:
<h3>HelloWorld Program (Text Output)</h3>
To display the "HelloWorld!" in the Text Output, copy this code and paste to the code editor:
<langsyntaxhighlight lang="basic256">Print "HelloWorld!"</langsyntaxhighlight>
Then press F5 or click the play button.<br>
<h3>HelloWorld Program (Graphics Output)</h3>
To display the "HelloWorld!" in the Graphics Output, copy this code and paste to the code editor:
<langsyntaxhighlight lang="basic256">clg # Clear the graphics screen
font "Arial",10,100 # Set the font style, size, and weight respectively
color black # Set the color...
text 0,0,"HelloWorld!" # Display in (x,y) the text HelloWorld!</langsyntaxhighlight>
Then press F5 or click the play button.<br>
<h3>Documentation</h3>
Line 435:
 
What the end product will look like:
<langsyntaxhighlight Befungelang="befunge">"!dlrow olleH">:#,_@</langsyntaxhighlight>
===Explanation===
 
Line 474:
 
If you're using Try BQN you can skip this step: once you have an environment set up, you need to type
<syntaxhighlight lang="text">rlwrap ./BQN</langsyntaxhighlight>
which will set up a repl.
 
Then type
<langsyntaxhighlight lang="bqn">"Hello, World!"</langsyntaxhighlight>
and press Enter (Shift-Enter if you're using Try BQN)
 
Line 578:
Install gcc as per C<br>
Create text file <code>helloworld.cpp</code>
<langsyntaxhighlight lang="cpp">#include <iostream>
int main() {
using namespace std;
cout << "Hello, World!" << endl;
return 0;
}</langsyntaxhighlight>
Compile it using <code>gcc</code>:
 
Line 594:
=={{header|Clojure}}==
# Install [http://leiningen.org/#install Leiningen].
# Generate a hello world app: <syntaxhighlight lang="text">$ lein new app my-hello</langsyntaxhighlight>
# Run it: <syntaxhighlight lang="text">$ cd my-hello
$ lein run
Hello, World!</langsyntaxhighlight>
# Edit the generated <tt>src/my-hello/core.clj</tt> file with your favorite [[Editor|texteditor]] to make changes.
# You don't have to edit files. Run the REPL (interactive shell) to experiment: <syntaxhighlight lang="text">$ lein repl</langsyntaxhighlight>
# Suggested reading: [http://dev.clojure.org/display/doc/Getting+Started Clojure's Getting Started Guide] and [http://www.braveclojure.com/ Clojure for the Brave and True]
 
=={{header|COBOL}}==
1) Install OpenCOBOL:
<syntaxhighlight lang="text">$ sudo apt-get install open-cobol</langsyntaxhighlight>
2) Open your [[Editor|texteditor]], and write the following code:
<langsyntaxhighlight lang="cobol">program-id. hello-world.
 
procedure division.
Line 612:
 
goback
.</langsyntaxhighlight>
3) Save the code to hello.cob, and compile it with OpenCOBOL. Note: if OpenCOBOL fails with the error 'unexpected end of file', add a trailing newline after the last period. Other likely errors may be caused by omitting the periods.
<syntaxhighlight lang="text">$ cobc -x -Wall -free ./hello.cob</langsyntaxhighlight>
4) Run the compiled program from the command line:
<syntaxhighlight lang="text">$ ./hello
Hello, World!</langsyntaxhighlight>
 
=={{header|Commodore BASIC}}==
Line 680:
2. Type the following program:
 
<syntaxhighlight lang="commodorebasicv2">
<lang CommodoreBASICv2>
10 PRINT "HELLO, WORLD!"
20 END
</syntaxhighlight>
</lang>
 
3. Type "RUN" and press Enter/Return.
Line 709:
===Hello World===
'''hello.lisp'''
<syntaxhighlight lang=""common lisp"">
<lang "Common Lisp">
(format t "Hello world!~%")
</syntaxhighlight>
</lang>
===Running It===
Exactly how to run it from the command line depends on your Lisp implementation. Of course, from the REPL you can always
run it by entering:
<syntaxhighlight lang=""common lisp"">
<lang "Common Lisp">
(load "hello.lisp")
</syntaxhighlight>
</lang>
...which is also how you load source files in order to add their definitions to your program.
SBCL has the <code>save-lisp-and-die</code> function, which saves whatever has been defined in the REPL into a stand-alone executable that includes a copy of SBCL itself (because Lisp programs can generate, compile, and run additional Lisp code at runtime, and then reference functions and variables created by that generated code).
Line 724:
# Install [https://coq.inria.fr/download Coq]:
#* On Windows and MacOS, download the [https://github.com/coq/platform/releases most recent release].
#* On Linux, run: <syntaxhighlight lang ="bash">sudo snap install coq-prover</langsyntaxhighlight>
# Open '''coqide''', the [https://coq.inria.fr/refman/practical-tools/coqide.html Coq Integrated Development Environment] (IDE). The large window on the left shows the current ''script buffer'', the upper window on the right is the ''goal window'', and below is the ''message window''.
# Write in the script buffer: <langsyntaxhighlight lang="coq">
Require Import Coq.Strings.String.
 
Eval compute in ("Hello world!"%string).
</syntaxhighlight>
</lang>
# Evaluate the buffer:
#* At the top of the IDE, the third icon from the left is a down arrow (↓). Press it twice to make the IDE evaluate the buffer.
Line 752:
2) Open your favorite [[Editor|texteditor]], write the following source code
 
<langsyntaxhighlight lang="d">import std.stdio;
 
void main()
{
writeln("Hello world!");
}</langsyntaxhighlight>
 
3) Save the source code under the name hello.d
Line 781:
No installation needed. To run EchoLisp, follow this link : [http://www.echolalie.org/echolisp EchoLisp].
=== Hello World ===
<langsyntaxhighlight lang="lisp">
;; This is a comment
;; Type in the following -uncommented- line in the input text area, and press [RETURN]
Line 789:
 
(display "Hello, World" "color:blue")
</syntaxhighlight>
</lang>
=== On-line help ===
The first thing to know are the "apropos", "usage", and "help" functions. Examples:
<langsyntaxhighlight lang="lisp">
;; usage give the syntax(es) for a function call
;; "usage" abbreviation is "us"
Line 815:
;; Just type-in a letter, and you will go to the alphabetical index.
 
</syntaxhighlight>
</lang>
=== Editing ===
Functions are provided to save data, functions definitions, in the browser local storage, without leaving the read-eval-print loop. However you can edit files, using any text file editor - UTF-8 compatible - and load/eval them with the "Load" button. TextWrangler is a good choice on Mac OS/X. It supports syntax hiliting for source lisp files. In any case, the EchoLisp team is ready to help you.
Line 831:
The resulting program will be a simple "Hello World!" program:
 
<langsyntaxhighlight lang="eiffel">
class
APPLICATION
Line 842:
end
end
</syntaxhighlight>
</lang>
 
Where the following notes apply:
 
* <syntaxhighlight lang ="eiffel">class APPLICATION ... end</langsyntaxhighlight> defines the simplest form of an Eiffel "class".
* <syntaxhighlight lang ="eiffel">create make</langsyntaxhighlight> defines a "creation procedure" (i.e. constructor) for the class <b>{APPLICATION}</b>.
* <syntaxhighlight lang ="eiffel">make do ... end</langsyntaxhighlight> is the implementation of the constructor specified with the <b>`create'</b> keyword (above).
* <langsyntaxhighlight lang="eiffel">print ( ... )</langsyntaxhighlight> is a feature inherited from class <b>{ANY}</b>—a class from which all Eiffel classes inherit (e.g. like {APPLICATION}). In the example the <syntaxhighlight lang ="eiffel">inherit ANY</langsyntaxhighlight> has been left out as it is implied by default.
 
=== Supported Platforms ===
Line 863:
# You have to add a path to _BIN_ folder to the system environment *PATH* or copy elenavm.dll and elenart.dll to _Windows\System32_ folder. Alternatively you may use setup project
# To create a simple program in ELENA we have to create a source file (e.g. program1.l) and write the following code:
<langsyntaxhighlight lang="elena">public program()
{
console.writeLine("Hello world")
}
</langsyntaxhighlight>
# Now it should be compiled (where elc is a command-line compiler):
<syntaxhighlight lang ="elena">elc program1.l</langsyntaxhighlight>
# It will create program1.exe file which you can execute:
<syntaxhighlight lang ="elena">program1</langsyntaxhighlight>
with the following result:
{{out}}
Line 890:
2) Open your [[Editor|texteditor]], write the following source code:
 
<langsyntaxhighlight lang="erlang">% Implemented by Arjun Sunel
-module(helloworld).
-export([main/0]).
 
main() ->
io:fwrite("Hello world!\n").</langsyntaxhighlight>
 
3) Save the source code under the name helloworld.erl
Line 991:
3. In the window type the following:
 
<langsyntaxhighlight lang="futurebasic">window 1
 
print @"Hello, World!"
 
HandleEvents</langsyntaxhighlight>
 
4. From FB's Command menu, select Build and Run "Hello, World!"
Line 1,060:
In your repository
Just type: (no class, no parentheses, no semicolon, no import)
<langsyntaxhighlight lang=""groovy"Groovy">println 'Hello to the Groovy world'</langsyntaxhighlight>
and save it in hello.groovy
On the command line, just type
Line 1,068:
Note you can also define a String to test the output message
example, in your hello.groovy file replace previous code by:
<langsyntaxhighlight lang=""groovy"Groovy">String hello = 'Hello to the Groovy world'
println hello</langsyntaxhighlight>
And you can add some assertions, for instance:
<langsyntaxhighlight lang=""groovy"Groovy">assert hello.contains('Groovy')
assert hello.startsWith('Hello')</langsyntaxhighlight>
 
=={{header|Haskell}}==
Install GHC:
<syntaxhighlight lang="text">$ sudo apt-get install ghc</langsyntaxhighlight>
Create hello.hs:
<syntaxhighlight lang="text">$ touch hello.hs
$ cat > hello.hs << HERE
main = putStrLn "Hello, World!"
HERE</langsyntaxhighlight>
Compile it:
<syntaxhighlight lang="text">$ ghc hello.hs -o hello</langsyntaxhighlight>
And run the executable:
<syntaxhighlight lang="text">$ ./hello
Hello, World!</langsyntaxhighlight>
 
===Non-Linux operating systems===
Line 1,101:
 
Type in:
<syntaxhighlight lang ="j">'Hello, World!'</langsyntaxhighlight>
 
A quicker alternative might be an [https://jsoftware.github.io/j-playground/bin/html2/ online version of J], if you are using a browser which supports [https://webassembly.org/ wasm].
Line 1,117:
 
 
2. Java programs are often developed with one of various full-featured IDEs, but this is not a requirement. For simplicity, we will stick with using only pre-installed text editors. After the installation has completed, open a terminal window (Command prompt on Windows) and try running the command: <syntaxhighlight lang ="shell">javac -version</langsyntaxhighlight> If you see an output similar to <code>javac <version_number></code>, the JDK was successfully installed. You are now prepared to develop and run Java applications.
 
 
3. Using a plain-text editor (vim, nano, emacs on UNIX-like operating systems, or notepad on Windows), re-type or copy and paste one of the following classes into the editor and save it as a file named <code>HelloWorld.java</code>. The file naming step is a very important, as a Java source code file ''must'' be named the same as it's (one and only) public class.
 
<syntaxhighlight lang="java">
<lang Java>
public class HelloWorld {
public static void main(String[] args) {
Line 1,129:
}
}
</syntaxhighlight>
</lang>
'''Output: Hello world!'''
 
'''Printing Hello world! in a more object-oriented manner'''
<syntaxhighlight lang="java">
<lang Java>
public class HelloWorld {
public static void main(String[]args){
Line 1,145:
}
}
</syntaxhighlight>
</lang>
'''Output: Hello world!'''
 
Line 1,162:
 
<code>console.log()</code> method:
<syntaxhighlight lang="text">console.log("Hello, World!");</langsyntaxhighlight>
 
This will be printed on the Console tab part of your web browser.
Line 1,168:
 
<code>alert()</code> method:
<syntaxhighlight lang="text">alert("Hello, World!");</langsyntaxhighlight>
 
This will appear in the shape of a 'pop-up' in your browser.
Line 1,217:
 
'''Data from stdin'''
<langsyntaxhighlight lang="sh">$ echo '"Hello world!"' | jq .
 
C:\ echo "Hello world!" | jq .</langsyntaxhighlight>
If there were a web server somewhere that provides "Hello world!" as JSON,
then we could also write something like:
<langsyntaxhighlight lang="sh">curl -Ss http://hello.world.com | jq .</langsyntaxhighlight>
 
'''Data from a file'''
<langsyntaxhighlight lang="sh">$ echo '"Hello world!"' > hello.txt
$ jq . hello.txt
 
C:\ echo "Hello world!" > hello.txt
C:\ jq . hello.txt</langsyntaxhighlight>
'''2) "Hello world!" as program'''
<langsyntaxhighlight lang="sh">$ jq -n '"Hello world!"'
 
C:\ jq -n "Hello world!</langsyntaxhighlight>
We could also put the program into a file. In this particular instance,
we could use the file hello.txt that was created above. In this
particular case also, the command is the same in all the environments
under consideration:
<langsyntaxhighlight lang="sh"> jq -n -f hello.txt .</langsyntaxhighlight>
In practice, it is recommended that jq programs be placed in text files with names
ending with the .jq suffix.
Line 1,252:
jq programs consist of definitions and pipelines. There is much to be said
for a style illustrated by the following example:
<langsyntaxhighlight lang="jq">def binary_digits:
if . == 0 then 0
else [recurse( if . == 0 then empty else ./2 | floor end ) % 2 | tostring]
Line 1,258:
| .[1:] # remove the leading 0
| join("")
end ;</langsyntaxhighlight>
 
=={{header|Julia}}==
Line 1,284:
</pre>
Now in Notepad, paste in the following and save it:
<langsyntaxhighlight lang="scala">fun main(args: Array<String>) {
println("Hello, World!")
}</langsyntaxhighlight>
 
Next type this at the command line to compile the program:
Line 1,304:
 
=={{header|Lambdatalk}}==
<langsyntaxhighlight lang="scheme">
The minimal installation is straightforward. Go to this URL:
 
Line 1,330:
 
Congratulations, your first web page is published.
</syntaxhighlight>
</lang>
 
=={{header|Locomotive Basic}}==
Line 1,339:
 
In CPCBasic, type
<langsyntaxhighlight lang="locobasic">10 print "Hello World!"</langsyntaxhighlight>
into the text box and click "Run". Output goes to the blue CPC screen below.
 
Line 1,345:
Without installing anything, lua-programs can be run online at the [http://www.lua.org/demo.html live demo]. <br>
It includes some demo-programs, such as
<langsyntaxhighlight lang="lua">io.write("Hello world, from ",_VERSION,"!\n")</langsyntaxhighlight>
 
For installing Lua, there are extensive instructions for [http://www.lua.org/start.html getting started] on Linux, MacOS and Windows.
Line 1,439:
Maple has multiple ways to display text on the screen, but the most simple way is to type the words you want printed, surrounded by double quotes, and followed by a semi-colon.
Example:
<langsyntaxhighlight Maplelang="maple">"Hello World";</langsyntaxhighlight>
"Hello World"
Congratulations, you executed your first line of code!
Line 1,473:
The easiest way to get started is to use any desktop computer with a web browser, and point it to [https://miniscript.org/tryit/ https://miniscript.org/tryit/]. In the code editor that appears at top-left, delete any example code already there, then type in the following:
 
<langsyntaxhighlight MiniScriptlang="miniscript">print "Hello World!"</langsyntaxhighlight>
 
Then click the '''Run Script''' button. The output will appear in the terminal-style (green text on a black background) box to the right or below the code editor (depending on the width of your browser window).
Line 1,502:
The code in hello.mt simply defines a function and then calls it:
 
<langsyntaxhighlight lang="monte">
def sayHello():
traceln("Hello World")
sayHello()
</syntaxhighlight>
</lang>
 
=={{header|MontiLang}}==
Line 1,512:
Download MontiLang binaries for windows or linux from http://montilang.ml, or from the releases page of https://github.com/lduck11007/MontiLang. Alternatively, you can easily build from source for easy customization with the instructions on Github.
 
To run MontiLang, open a shell by typing <langsyntaxhighlight MontiLanglang="montilang">monti</langsyntaxhighlight> in the terminal, or run a program by specifying <syntaxhighlight lang MontiLang="montilang">monti file.mt</langsyntaxhighlight> For documentation on the language, see file 'Documentation.mt' in /examples on github.
 
Here is a simple Hello World program in MontiLang
 
<syntaxhighlight lang MontiLang="montilang">|Hello, World!| PRINT .</langsyntaxhighlight>
 
=={{header|Nemerle}}==
Line 1,561:
2) Open a text editor and create a file named ''hello.nim'' with the following contents:
 
<langsyntaxhighlight lang="nim">echo "Hello world!"</langsyntaxhighlight>
 
3) Open a terminal console, and run the following command:
Line 1,580:
=== “Hello world!” as a string ===
 
# Open your [[Editor]] and write the following line: <langsyntaxhighlight lang="nix">"Hello world!"</langsyntaxhighlight>
# Save the file as <code>hello.nix</code>.
# Evaluate the file as input. <pre>nix-instantiate --eval hello.nix</pre>
Line 1,588:
A derivation in Nix represents a single build step. The output of a derivation is a path in the Nix store.
 
# Open your [[Editor]] and write the following line: <langsyntaxhighlight lang="nix">(import <nixpkgs> { }).writeText "hello" "Hello world!\n"</langsyntaxhighlight> This represents a derivation that uses <code>writeText</code> from <code>nixpkgs</code> as a builder to write an output in the Nix store with the suffix “hello” containing the contents “Hello World!”.
# Save the file as <code>hello-derivation.nix</code>
# Build the derivation. <pre>nix-build hello-derivation.nix</pre> The derivation result is a path in the Nix store. A symlink <code>result</code> is also created in the current directory pointing to the path of the result in the nix store.
Line 1,633:
Create file: 'hello.ml'
 
Type in file: <langsyntaxhighlight lang="ocaml">print_string "Hello world!\n";;</langsyntaxhighlight>
 
Compile with: <syntaxhighlight lang Shell="shell">ocamlc -o hello hello.ml</langsyntaxhighlight>
 
Run as: <syntaxhighlight lang Shell="shell">./hello</langsyntaxhighlight>
 
=={{header|Oforth}}==
Line 1,651:
Type in file:
 
<langsyntaxhighlight Oforthlang="oforth">"Hello world!" println</langsyntaxhighlight>
 
Run as: <syntaxhighlight lang Shell="shell">oforth hello.of</langsyntaxhighlight>
 
Or you can use oforth command line directly :
 
<langsyntaxhighlight Shelllang="shell">oforth --P"\"Hello world!\n\" println"</langsyntaxhighlight>
 
=={{header|Pare}}==
Line 1,665:
Download: https://bitbucket.org/parelang/pare/downloads/pare
 
Create file 'hello.l': <langsyntaxhighlight Parelang="pare">(print "hello world")</langsyntaxhighlight>
Run: <syntaxhighlight lang Shell="shell">perl pare hello.l</langsyntaxhighlight>
 
=={{header|PARI/GP}}==
Line 1,690:
===Your first program===
Open a [[Editor|texteditor]] of your choice and type
<langsyntaxhighlight lang="parigp">print("Hello, world!")</langsyntaxhighlight>
Save the file in your PARI working directory and start the program, either in a console (command: <code>gp</code>) or in the GUI in Windows (by double-clicking the shortcut). Type <code>\r filename</code> to read in the program. (If you saved the file with a .gp extension, you can leave it off here.)
The program executes, displaying "Hello, world!".
Line 1,738:
=={{header|Perl}}==
See [http://www.perl.org/get.html Download Perl Distributions]
<langsyntaxhighlight lang="perl">=head1 Obtaining perl
 
On the majority of UNIX and UNIX-like operating systems
Line 1,806:
 
#!/usr/bin/perl
print "Hello, World!\n";</langsyntaxhighlight>
 
=={{header|Phix}}==
Line 1,824:
(A cross platform editor is currently in progress, try "pw edix" to run that.)<br>
Enter the following:
<!--<langsyntaxhighlight Phixlang="phix">-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello world!"</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
Save as test.exw in the installation directory and run "p test".<br>
The output will appear in the command prompt/terminal.<br>
Line 1,840:
steps may be required to install IUP, see demo/pGUI/lnx/installation.txt, otherwise any editor will do.<br>
Enter the following:
<!--<langsyntaxhighlight Phixlang="phix">-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello world!"</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
Save as test.exw in the installation directory and run "./phix test".<br>
You can also save the file anywhere and press F5 in edix to run it.<br>
Line 1,850:
 
Once you have either of the above up and running, run pwa/p2js.exw then select an existing file or paste in
<!--<langsyntaxhighlight Phixlang="phix">-->
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello world!"</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
and press F5, which will create/overwrite pwa/test.htm and open it in your browser. Alternatively you can use Ctrl W to show/overwrite only, and then refresh an already open browser tab.
One day I hope to have that runnable in a browser and online, and probably have some command line packaging options.
Line 1,859:
 
If showing a little bit of text is one thing, the next has to be running a proper GUI application. The distribution includes
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- pwa\phix\hello_world.exw
Line 1,876:
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</langsyntaxhighlight>-->
and you can run that without any further ado, at least on Windows, or online [http://phix.x10.mx/p2js/hello_world.htm here]. A few improvements are probably warranted, as in changes to pGUI.js and/or pGUI.css, but at least the language/transpiler side of things is pretty much complete. On Linux you would have to install IUP, following their standard instructions, which any proper Linux person should find easy-peasy, right, though I usually struggle a bit, and some quite a lot.
 
Line 1,957:
Now go to your Working folder. Click the letter 'N' at the top menu, then click on 'New Directory...' and name a new directory (say, "HelloWorld1") inside the Working folder. Open the new folder and press <b>Ctrl+V</b>. Regardless of what's in your clipboard, the IDE will place "the noodle" file in the folder. The "the noodle" file is another source code that acts like a "header file" in C, but is <i>required</i> for the codes to run.
Click the letter 'N' again, but this time, click on 'New Text File...' and name a new text file to whatever you want, <b>but make sure it doesn't have any file extensions!</b> Open the new text file and copy the following code:
<langsyntaxhighlight lang="plainenglish">To run: \This is a comment
Start up.
Write "Hello World!" to the console.
wAIt fOr tHe eScApE kEY. \Plain English is case-insensitive
Shut down.</langsyntaxhighlight>
To run the code, just press <b>Ctrl+R</b>. As the code says in <i>Plain English</i>, "Hello World!" should now be written, and you have to press the Escape key to shut it down.
Upon running the code, it will be compiled automatically to a standalone EXE file in the same directory as the text file. Take note that the name of the <i>directory</i> in which the text file is created will be used as the name of the EXE file (so, "HelloWorld1.exe"). Like most text editors, you may press <b>Ctrl+S</b> to save the file. To quit the IDE, you may press <b>Ctrl+Q</b> or click the letter 'Q', then click 'Quit.'
Line 1,967:
=== Plain Graphical HelloWorld ===
Make another directory inside your Working folder (say, "HelloWorld2"), and do the steps as above in the console version. This time, the code is as follows:
<langsyntaxhighlight lang="plainenglish">To run:
Start up.
Clear the screen.
Line 1,973:
Refresh the screen.
Wait for the escape key.
Shut down.</langsyntaxhighlight>
This time, the background is black, and the "Hello World!" text is green.
=== Documentation ===
Line 1,986:
===Executing the "HelloWorld" Code in Console===
Now, to execute your first code in PowerShell, choose from the two options above to access the PowerShell console. If the console is already open, type any of these codes:
<langsyntaxhighlight lang="powershell">"Hello, World!" #This is a comment.</langsyntaxhighlight>
or,
<langsyntaxhighlight lang="powershell">wRiTe-HOsT "Hello, World!" #PowerShell is case-insensitive.</langsyntaxhighlight>
or,
<langsyntaxhighlight lang="powershell">Write-Host Hello`, World! #The backtick escapes the next character.</langsyntaxhighlight>
Your output should be:
<pre>Hello, World!</pre>
Line 2,029:
To print 'Hello World' to the console, we type;
 
<langsyntaxhighlight Processinglang="processing">print("Hello World!");</langsyntaxhighlight>
 
We can also replace hello world, with any string, providing its between two quotation marks (").
Line 2,035:
A fun development of this would be to create a variable of type string, and pump that into the print command!
 
<langsyntaxhighlight Processinglang="processing">String x = "What up!";
 
print(x); </langsyntaxhighlight>
 
Enjoy!
Line 2,061:
Use the File->New window item of the GUI to bring up new blank window
and copy the text from [[Hello world/Text#Python]] into it,
i.e. <langsyntaxhighlight lang="python">print "Goodbye, World!"</langsyntaxhighlight>
use the File menu to save the file with a name hello.py,
(remember the .py extension).
Line 2,167:
===Writing Ra Code===
Create a plain text file and enter the following text:
<syntaxhighlight lang="ra">
<lang Ra>
class HelloWorld
**Prints "Goodbye, World!"**
Line 2,174:
print "Goodbye, World!"
</syntaxhighlight>
</lang>
Save the plain text file as "HelloWorld.racode" (all Ra files must end with the .racode extension).
 
Line 2,216:
===Hello World===
Save it as "hello.rkt":
<langsyntaxhighlight lang="racket">
#lang racket
(displayln "Hello world!")
</syntaxhighlight>
</lang>
 
===Running it===
Line 2,290:
to invoke the appropriate interpreter.
<br>So, a <tt> Hello world! </tt> REXX program (two lines) could look like:
<langsyntaxhighlight lang="rexx">/*REXX program to greet the world enthusiastically. */
say "Hello world!"</langsyntaxhighlight>
The above program could be made into one statement
(since REXX comments are treated like whitespace).
Line 2,324:
=={{header|Ring}}==
{{incomplete|Ring|No installation instructions}}
<langsyntaxhighlight lang="ring">
sayHello()
 
func sayHello
see "Hello World" + nl
</syntaxhighlight>
</lang>
 
=={{header|Robotic}}==
Line 2,354:
===The Code===
The code is as simple as it looks:
<langsyntaxhighlight lang="robotic">
* "Hello world!"
end
</syntaxhighlight>
</lang>
 
After typing the code down, hit ESC and press Alt+T to test it out. If done properly, you will see "Hello World" flashing at the bottom of the screen.
Line 2,375:
2. Use your favorite [[Editor|text editor]].
 
3. Open the text editor and type the following: <langsyntaxhighlight Rubylang="ruby">
puts "Hello World!!"
</syntaxhighlight>
</lang>
 
4. Save the file with the extension .rb
Line 2,390:
A complete description of how to install the language can be found on the [http://www.rust-lang.org/install.html Install page] of the [http://www.rust-lang.org Rust web site]. However, for the purposes of trying out code examples, use the [http://play.rust-lang.org online REPL] which allows you to enter code, compile it and run it within a single browser window.
 
<langsyntaxhighlight lang="rust">fn main() {
println!("Hello world!");
}</langsyntaxhighlight>
 
=={{header|Scala}}==
Line 2,399:
 
Run a program using '''Windows PowerShell''':
<langsyntaxhighlight Scalalang="scala">scala -e 'println(\"Hello_world\")'</langsyntaxhighlight>
The double quotes have to be escaped.
 
Line 2,425:
 
Run in-line commands
<langsyntaxhighlight Bashlang="bash">setl 'print("Hello, world!");'</langsyntaxhighlight>
or create a file 'myscript.setl'
<langsyntaxhighlight SETLlang="setl">print("Hello, world!");</langsyntaxhighlight>
and run it
<syntaxhighlight lang Bash="bash">setl myscript.setl</langsyntaxhighlight>
 
Documentation on the setl command can be found [http://setl.org/doc/setl-user.html here] and a paper on the SETL language can be found [https://www.researchgate.net/publication/238739905_An_introduction_to_the_set_theoretical_language_SETL here].
Line 2,583:
At the prompt, you can just type in Tcl commands and have them executed immediately.
For example, if you type in this little program:
<langsyntaxhighlight lang="tcl">puts "Hello World"</langsyntaxhighlight>
You will get this message printed out:
<pre>Hello World</pre>
Line 2,632:
 
Type in code so your screen looks like this (where MYPROGRM is the name of your program):
<langsyntaxhighlight lang="ti83b">PROGRAM:MYPROGRM
:Disp "HELLO, WORLD!"</langsyntaxhighlight>
 
Disp is found under the "I/O" tab of the menu from the "PRGM" key,
Line 2,663:
The program should look like this when it's done:
 
<langsyntaxhighlight lang="ti83b">PROGRAM:HELLO
:AsmPrgm
:219F9D
Line 2,669:
:EF2E45
:C9
:48656C6C6F2C20576F726C642100</langsyntaxhighlight>
 
=={{header|Transd}}==
Line 2,676:
* Create a file named "hello.td" with the following content:
 
<langsyntaxhighlight lang="scheme">
#lang transd
 
Line 2,682:
_start: (lambda (textout "Hello, World!"))
}
</syntaxhighlight>
</lang>
 
* Start FREND shell and type at the command prompt the following:
Line 2,695:
Visit https://www.ultimatepp.org/www$uppweb$download$en-us.html. From the website choose download that represents your operating system. The website has detailed instructions for installations. The graphical Hello World is in the examples section of the GUI package manager. It is as simple as double-clicking the HelloWorld module or selecting it and clicking the OK button.
 
<syntaxhighlight lang="cpp">
<lang Cpp>
#include <CtrlLib/CtrlLib.h>
// submitted by Aykayayciti (Earl Lamont Montgomery)
Line 2,745:
GoodbyeWorld().Run();
}
</syntaxhighlight>
</lang>
 
=={{header|Wren}}==
Line 2,753:
 
So open the text editor, paste in the following script (yes, it's only one line), and save it to a file called ''hello.wren'' in the same directory as wren-cli itself:
<langsyntaxhighlight lang="ecmascript">System.print("Hello world!")</langsyntaxhighlight>
Now type at the command line (omit ./ if using Windows):
<pre>
Line 2,773:
</pre>
====Example====
<langsyntaxhighlight lang="asm">
option casemap:none
option literals:on
Line 2,802:
main endp
end
</syntaxhighlight>
</lang>
Assemble & Link
<pre>
Line 2,828:
====Example====
Using stdc, and the [https://docs.microsoft.com/en-us/cpp/build/x64-software-conventions?redirectedfrom=MSDN&view=msvc-160 windows ABI]
<langsyntaxhighlight lang="asm">
global main
 
Line 2,844:
call ExitProcess
ret
</syntaxhighlight>
</lang>
Assemble & Link
<pre>
Line 2,853:
Using NASM on Linux.
libc PIE example..
<langsyntaxhighlight lang="asm">
extern printf
extern exit
Line 2,868:
call [rel exit wrt ..got]
ret
</syntaxhighlight>
</lang>
Using Linux syscalls..
<langsyntaxhighlight lang="asm">
; ------------------------------------------------------------------------------
; To assemble:
Line 2,895:
xor rdi, rdi ; exit code 0
syscall
</syntaxhighlight>
</lang>
 
===Editors and IDEs===
Line 2,911:
 
===Debug output to stderr===
<langsyntaxhighlight lang="zig">// - Install zig from https://ziglang.org/download/.
// - Extract into your path
// - `zig run newbie.zig`
Line 2,921:
// Do not use debug code in production.
std.debug.print("Hello, World!\n");
}</langsyntaxhighlight>
 
===Using standard streams===
<langsyntaxhighlight lang="zig">const std = @import("std");
 
pub fn main() !void {
Line 2,932:
// for code flow adjustments
try stdout.writer().writeAll("Hello world!\n");
}</langsyntaxhighlight>
 
=={{header|zkl}}==
Line 3,010:
You have now typed the first line of the program. Press the ENTER key. The program line will now appear at the top of the screen as follows:
 
<langsyntaxhighlight lang="zxbasic">10 PRINT "Hello"</langsyntaxhighlight>
 
The cursor returns to a flashing K indicating that a keyword is expected again. Press the letter R. We now get the keyword RUN followed by a flashing L cursor. This time we have not entered a line number, because we want the command to be executed immediately. Press ENTER. The program will run and you should see the following:
10,333

edits