Below are examples of how to write "Hello, World!" in 50 different programming languages. Click the "Copy" button to copy the code to your clipboard.
1. Python
print("Hello, World!")
2. Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
3. C
#include <stdio.h>
int main() {
printf("Hello, World!\\n");
return 0;
}
4. C++
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
5. JavaScript
console.log("Hello, World!");
6. Ruby
puts "Hello, World!"
7. PHP
<?php
echo "Hello, World!";
?>
8. Swift
print("Hello, World!")
9. Kotlin
fun main() {
println("Hello, World!")
}
10. Go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
11. Rust
fn main() {
println!("Hello, World!");
}
12. TypeScript
console.log("Hello, World!");
13. R
print("Hello, World!")
14. Perl
print "Hello, World!\\n";
15. Scala
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, World!")
}
}
16. Shell Script (Bash)
echo "Hello, World!"
17. Lua
print("Hello, World!")
18. Objective-C
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"Hello, World!");
}
return 0;
}
19. Haskell
main = putStrLn "Hello, World!"
20. Dart
void main() {
print('Hello, World!');
}
21. MATLAB
disp('Hello, World!')
22. Pascal
program HelloWorld;
begin
writeln('Hello, World!');
end.
23. Fortran
program HelloWorld
print *, "Hello, World!"
end program HelloWorld
24. Visual Basic .NET
Module HelloWorld
Sub Main()
Console.WriteLine("Hello, World!")
End Sub
End Module
25. SQL (MySQL)
SELECT 'Hello, World!';
26. COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, World!'.
STOP RUN.
27. Erlang
-module(hello).
-export([world/0]).
world() ->
io:format("Hello, World!~n").
28. Ada
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello_World is
begin
Put_Line ("Hello, World!");
end Hello_World;
29. Groovy
println 'Hello, World!'
30. Elixir
IO.puts "Hello, World!"
31. Julia
println("Hello, World!")
32. TCL
puts "Hello, World!"
33. Assembly (x86)
section .data
hello db 'Hello, World!', 0
section .text
global _start
_start:
mov eax, 4
mov ebx, 1
mov ecx, hello
mov edx, 13
int 0x80
mov eax, 1
xor ebx, ebx
int 0x80
34. Prolog
:- initialization(main).
main :- write('Hello, World!'), nl.
35. F#
printfn "Hello, World!"
36. VHDL
library ieee;
use ieee.std_logic_1164.all;
entity HelloWorld is
end HelloWorld;
architecture Behavioral of HelloWorld is
begin
process
begin
report "Hello, World!";
wait;
end process;
end Behavioral;
37. Lisp
(write-line "Hello, World!")
38. ABAP
WRITE 'Hello, World!'.
39. OCaml
print_endline "Hello, World!"
40. Scheme
(display "Hello, World!") (newline)
41. Verilog
module HelloWorld;
initial begin
$display("Hello, World!");
$finish;
end
endmodule
42. Crystal
puts "Hello, World!"
43. Apex
System.debug('Hello, World!');
44. Nim
echo "Hello, World!"
45. Racket
#lang racket
"Hello, World!"
46. Smalltalk
Transcript show: 'Hello, World!'.
47. VBA
Sub HelloWorld()
MsgBox "Hello, World!"
End Sub
48. Logo
print [Hello, World!]
49. Batch
@echo off
echo Hello, World!
pause
50. Jinja
{{ "Hello, World!" }}