Hello World in Programming: A Multi-Language Reference

"Hello, World!" is the canonical first program for programmers everywhere. Below you'll find a carefully curated list of real Hello World examples in a wide variety of programming languages, from the most popular to more obscure and academic ones. Use this as reference or inspiration as you explore new languages!

Hello World Examples in Major Programming Languages

Language Code Example
Python
print("Hello, World!")
JavaScript
console.log("Hello, World!");
C
#include 
int main() {
    printf("Hello, World!\n");
    return 0;
}
Java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
PHP
Hello, World!
Ruby
puts "Hello, World!"
Go
package main
import "fmt"
func main() {
    fmt.Println("Hello, World!")
}
Bash
echo "Hello, World!"
Rust
fn main() {
    println!("Hello, World!");
}
Kotlin
fun main() {
    println("Hello, World!")
}
C++
#include 
int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
Swift
print("Hello, World!")
Perl
print "Hello, World!\n";
Scala
object HelloWorld extends App {
  println("Hello, World!")
}
Haskell
main = putStrLn "Hello, World!"
SQL
SELECT 'Hello, World!';
MATLAB
disp('Hello, World!')
Lua
print("Hello, World!")
TypeScript
console.log("Hello, World!");
Assembly (x86 NASM)
section .data
    msg db 'Hello, World!',0Ah
section .text
global _start
_start:
    mov edx,13
    mov ecx,msg
    mov ebx,1
    mov eax,4
    int 0x80
    mov eax,1
    int 0x80

Want even more? Explore Hello World in context or return home for beginner content.