The following is a list of some Hello, world! programs.
- Hello, world! programs make the text “Hello, world!” appear on a computer screen.
- It is usually the first program encountered when learning a programming language.
- Otherwise, it’s a basic sanity check for an installation of a new programming language.
- If “Hello World” does not run, one must not try to develop complex programs before fixing the issues with the installation.
AWK#
1
| BEGIN { print "Hello, world!" }
|
Bash#
1
2
3
4
5
6
7
| #include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}
|
C++#
1
2
3
4
5
6
| #include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
|
CSS#
1
2
3
4
| /* Hello World in CSS */
body:before {
content: "Hello World";
}
|
1
2
3
4
5
6
7
| package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
|
HTML#
1
2
3
4
5
6
7
8
9
| <!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
|
JavaScript#
JavaScript does not have native (built in) input or output routines. Instead it relies on the facilities provided by its host environment.
Using a standard Web browser’s document object
1
| document.write('Hello, World!');
|
or with an alert, using a standard Web browser’s window object (window.alert)
1
| alert('Hello, world!');
|
or, from the Mozilla command line implementation
1
| print('Hello, world!');
|
or, from the Windows Script Host
1
| WScript.Echo('Hello, world!');
|
or, from Apple Safari, or Google Chrome debug console
1
| console.log('Hello, world!');
|
PowerShell#
or
1
| Write-Host "Hello, world!"
|
or
or
1
| [System.Console]::WriteLine("Hello, world!")
|
Python#
Rust#
1
2
3
| fn main() {
println!("Hello, world!");
}
|
sed#
1
| sed -ne '1s/.*/Hello, world!/p'
|
SQL#
1
2
3
4
| CREATE TABLE message (text char(15));
INSERT INTO message (text) VALUES ('Hello, world!');
SELECT text FROM message;
DROP TABLE message;
|
Swift#