DEV Community

Wahyu Kristianto for Devtical

Posted on

Exploring 'Hello World' in Various Programming Languages

Have you ever wondered why every programming tutorial or book starts with a simple program called "Hello World"? This program is very simple and only prints the message "Hello World" to the screen, but it has a deep meaning for programmers.

In this article, we will cover a simple "Hello World" program in various programming languages. Through this article, we will explore the syntax of different programming languages used to create a simple "Hello World" program. Let's get started!

1. C++

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
Enter fullscreen mode Exit fullscreen mode

2. Java

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}
Enter fullscreen mode Exit fullscreen mode

3. Python

print("Hello World!")
Enter fullscreen mode Exit fullscreen mode

4. JavaScript

console.log("Hello World!");
Enter fullscreen mode Exit fullscreen mode

5. Ruby

puts "Hello World!"
Enter fullscreen mode Exit fullscreen mode

6. PHP

<?php
echo "Hello World!";
?>
Enter fullscreen mode Exit fullscreen mode

7. Swift

print("Hello World!")
Enter fullscreen mode Exit fullscreen mode

8. Rust

fn main() {
    println!("Hello World!");
}
Enter fullscreen mode Exit fullscreen mode

9. Go

package main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}
Enter fullscreen mode Exit fullscreen mode

10. Brainfuck

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
Enter fullscreen mode Exit fullscreen mode

11. Perl

print "Hello World!\n";
Enter fullscreen mode Exit fullscreen mode

12. Kotlin

fun main() {
    println("Hello World!")
}
Enter fullscreen mode Exit fullscreen mode

13. Lua

print("Hello World!")
Enter fullscreen mode Exit fullscreen mode

14. Dart

void main() {
  print("Hello World!");
}
Enter fullscreen mode Exit fullscreen mode

15. Bash

echo "Hello World!"
Enter fullscreen mode Exit fullscreen mode

16. Assembly

section .data
    hello db 'Hello World!',0

section .text
    global _start

_start:
    mov eax, 4      ; write system call
    mov ebx, 1      ; stdout file descriptor
    mov ecx, hello  ; message to write
    mov edx, 13     ; message length
    int 0x80        ; call kernel

    mov eax, 1      ; exit system call
    xor ebx, ebx    ; exit status code
    int 0x80        ; call kernel
Enter fullscreen mode Exit fullscreen mode

17. Pascal

program HelloWorld;

begin
  writeln('Hello World!');
end.
Enter fullscreen mode Exit fullscreen mode

18. TypeScript

console.log("Hello World!");
Enter fullscreen mode Exit fullscreen mode

19. Julia

println("Hello World!")
Enter fullscreen mode Exit fullscreen mode

20. R

cat("Hello World!\n")
Enter fullscreen mode Exit fullscreen mode

21. Crystal

puts "Hello World!"
Enter fullscreen mode Exit fullscreen mode

22. Elixir

IO.puts "Hello World!"
Enter fullscreen mode Exit fullscreen mode

23. Groovy

println "Hello World!"
Enter fullscreen mode Exit fullscreen mode

24. Scala

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello World!")
  }
}
Enter fullscreen mode Exit fullscreen mode

25. Ada

with Ada.Text_IO; use Ada.Text_IO;

procedure Hello_World is
begin
   Put_Line("Hello World!");
end Hello_World;
Enter fullscreen mode Exit fullscreen mode

The world of programming languages is vast and diverse, ranging from the most widely used to the least known. We hope that this article has provided you with an interesting insight into the "Hello World" program in various programming languages.

If you have any additional "Hello World" examples in other programming languages or any feedback on this article, please feel free to leave a comment. We welcome your contributions and look forward to hearing from you.

Top comments (0)