"Hello World" In Different Programming Languages

"Hello World" In Different Programming Languages

·

1 min read

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!"