Hello World!
Introduction
“Hello, World!” is the most famous and widely used example of a program in the history of computing: a short program that prints the message Hello, World! on the screen and serves as the first instruction for language syntax, a test environment, or a demonstration that the compiler/runtime tool works correctly.
History and origin
The practice of displaying a short greeting message as an example has its roots in early test programs for interacting with terminals and teletype devices, but the tradition of the exact phrase “hello, world” was popularized by an example in the 1978 book The C Programming Language. The first documented example using the phrase comes from earlier material by Brian Kernighan and probably from the BCPL environment of the late 1960s and early 1970s.
Who invented Hello, World?
It is not about one person who came up with a phrase like a patent; The key points are:
- Brian Kernighan is the author of an example that has appeared in documents and tutorials related to B/BCPL and later in C.
- There is a strong link between early BCPL examples and later appearances in the C literature, so the tradition can be traced through the works of Kernighan and earlier examples in the BCPL community.
How and where it is applied
- Education — the first program students write to learn the basic syntax and flow of program development.
- Installation test — checks whether the compiler, interpreter or runtime is installed correctly.
- Documentation and tutorials — serves as a minimal, understandable example to demonstrate the functionality of a language or library.
- Benchmarking and sanity check — in some tools, it is used as the simplest execution test.
Short comparison table (attributes relevant to Hello World)
| Language | Typical Duration (Lines) | Printing method | Note |
| C | 3–5 | printf | Minimal runtime, requires compilation |
| Pascal | 3 | writeln | Participated in education |
| C++ | 3–5 | std::cout | Modern and old styles |
| Java | 7–10 | System.out.println | Class and Main Required. |
| JavaScript | 1–2 | console.log | interpreter, in a browser or Node.js |
| PHP | 1–3 | echo | Server-side or CLI |
| Python | 1 | The shortest and most honorable in learning | |
| C# | 5–8 | Console.WriteLine | Class and Main required. |
| SQL | 1 | SELECT ‘Hello, World!’; | Declarative example |
| TypeScript | 1–3 | console.log | Translated into JS |
| Visual Basic | 3–6 | Console.WriteLine | Different syntax styles |
| R | 1 | print(“Hello, World!”) | Interactive language for statistics |
| Perl | 1 | Scripting language, often short | |
| Fortran | 3–5 | print/write | It’s an old scientific language |
| Ada | 4–6 | Put_Line | Strict program structure |
| COBOL | 8–12 | DISPLAY | Verbal syntax |
| Assembly x86 | 10+ | System Call | Low-level example |
| ARM64 (Apple Silicon) | 10+ | System Call | AArch64; macOS syscalls are different from Linux. |
Examples of short Hello World programs
C
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}Pascal (Free Pascal / Turbo Pascal)
program HelloWorld;
begin
writeln('Hello, World!');
end.C++
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}JavaScript (Node.js / browser console)
console.log("Hello, World!");PHP (CLI or embedded)
<?php echo "Hello, World!\n";
Python
print("Hello, World!")C#
using System;
class Program {
static void Main() {
Console.WriteLine("Hello, World!");
}
}SQL (ANSI SQL)
SELECT 'Hello, World!';
TypeScript
console.log("Hello, World!");Visual Basic .NET
Module Hello
Sub Main()
Console.WriteLine(“Hello, World!”)
End Sub
End Module
MITS ALTAIR BASIC
10 PRINT "HELLO WORLD!"
R
print("Hello, World!")Perl
print "Hello, World!\n";
Delphi (Object Pascal)
program HelloWorld;
begin
Writeln('Hello, World!');
end.Fortran (modern)
program hello print *, "Hello, World!" end program hello
Ada
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line("Hello, World!");
end Hello;COBOL
IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. PROCEDURE DIVISION. DISPLAY "Hello, World!". STOP RUN.
Assembly x86 (Linux, NASM)
section .data msg db "Hello, World!", 10 len equ $ - msg section .text global _start _start: mov rax, 1 ; sys_write mov rdi, 1 ; stdout mov rsi, msg mov rdx, len syscall mov rax, 60 ; sys_exit xor rdi, rdi syscall
ARM64 / AArch64
(Linux; Apple Silicon uses the same architecture, but macOS syscalls are different)
section .data msg db "Hello, World!", 10 len equ $ - msg section .text global _start _start: mov rax, 1 ; sys_write mov rdi, 1 ; stdout mov rsi, msg mov rdx, len syscall mov rax, 60 ; sys_exit xor rdi, rdi syscall
Note: Apple’s M-series (M1/M2/M4, etc.) uses the AArch64 instruction set, but macOS uses different syscall numbers and ABI details; the example above works on Linux for AArch64. For macOS assembly, it is necessary to customize calls and conventions.
Meaning and influence
- Cultural symbol: It has become a recognizable symbol of the beginning of learning programming and is often used in memes, presentations, and courses.
- Standardization of examples: due to its simplicity, it allows direct comparison of basic syntax and tools between languages.
And the Conclusion
Hello, World! is more than just a simple example — it’s a cultural and practical standard in computer science that connects generations of programmers and serves as the first step in learning a language or checking out the work environment. Its history is evolutionary and related to works such as Brian Kernighan’s tutorials and early BCPL examples.