• 1 min read

Hello World in Different Programming Languages

Explore how to write a clean Hello World program across 20+ programming languages including Python, Java, Rust, Swift, Go, Kotlin, TypeScript and C++.

Hello World in Different Programming Languages

Here are some examples of how to write a “Hello, world!” program in various programming languages:

Python

print("Hello, world!")

Java

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}

C

#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

C++

#include <iostream>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

JavaScript

console.log("Hello, world!");

Ruby

puts "Hello, world!"

PHP

<?php
echo "Hello, world!";
?>

Go

package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}

Swift

print("Hello, world!")

Dart

void main() {
  print('Hello, World!');
}

Rust

fn main() {
    println!("Hello, world!");
}

Kotlin

fun main() {
    println("Hello, world!")
}

Lua

print("Hello, world!")

Perl

print "Hello, world!\n";

Bash

#!/bin/bash
echo "Hello, world!"
P
Written by Piush KS · Mobile & Full-Stack Developer

Engineer specializing in Android, iOS, Flutter, and web applications. Focuses on scalable software architectures, performance optimization, and developer productivity tools.

🛠️ Explore free developer tools: format JSON, test code, inspect SVGs, and pick colors.
Explore All Tools →
Separator