DEV Community

Cover image for "Hello World" in 10 Languages
Rakesh KR
Rakesh KR

Posted on

17

"Hello World" in 10 Languages

Hello World πŸ‘‹πŸŒ

Let's go through the "Hello World" syntax in 10 languages πŸ±β€πŸ’».

Feel free to comment ✍️ your first πŸ₯‡ "Hello World" language.

1. Java

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

2. C

#include<stdio.h>
int main(){
printf("Hello World");
return 0;
}
Enter fullscreen mode Exit fullscreen mode

3. C++

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

4. C#

public class Hello{
  public static void Main(String[] args){
    System.Console.WriteLine("Hello World");
  }
}
Enter fullscreen mode Exit fullscreen mode

5. Python

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

6. JS

console.log("Hello World");

alert("Hello World");

document.write("Hello World");
Enter fullscreen mode Exit fullscreen mode

7. GO

package main
import "fmt"

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

8. Kotlin

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

9. PHP

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

10. Swift

import Swift
print("Hello World")
Enter fullscreen mode Exit fullscreen mode

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (15)

Collapse
 
szabgab profile image
Gabor Szabo β€’

Rust

fn main() {
    println!("Hello World")
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
lexlohr profile image
Alex Lohr β€’

x86 asm (DOS .com executable)

org 0x100
mov dx, msg
mov ah, 9
int 0x21
int 0x20
msg db 'Hello World!', 0x0d, 0x0a, '$'
Enter fullscreen mode Exit fullscreen mode

x86 asm (Linux compatible)

; to build an ELF executable:
; nasm -f elf hello.asm && ld -s -o hello hello.o
section .text
  global _start
section .data
  msg db 'Hello World!, 0xa
  len equ $ - msg
section .text
_start:
mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80
mov ebx, 0
mov eax, 1
int 0x80
Enter fullscreen mode Exit fullscreen mode

AWK

BEGIN {
  print "Hello World!"
}
Enter fullscreen mode Exit fullscreen mode

and last, not least:

CSS

document.body:before { content: "Hello, World!"; }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
szabgab profile image
Gabor Szabo β€’

Bash

echo Hello World
Enter fullscreen mode Exit fullscreen mode
Collapse
 
thomasbnt profile image
Thomas Bnt β€’

Hello ! Cool post to learn a little more about syntax of others languages with an example! πŸ‘πŸΌ

Don't hesitate to put colors on your codeblock like this example for have to have a better understanding of your code 😎

console.log('Hello world!');
Enter fullscreen mode Exit fullscreen mode

Example of how to add colors and syntax in codeblocks

Collapse
 
alexkapustin profile image
Oleksandr β€’

Brainfuck:

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

en.wikipedia.org/wiki/Brainfuck

Collapse
 
sherrydays profile image
Sherry Day β€’

ChatGPT

Hello, my name is world.
Enter fullscreen mode Exit fullscreen mode
Collapse
 
lum1nat profile image
Lum1naT β€’

This reply makes me happy while making my blood boil.

Collapse
 
ben profile image
Ben Halpern β€’

Ruby

puts "Hello world!"
Enter fullscreen mode Exit fullscreen mode
Collapse
 
gramian profile image
Christian Himpe β€’

Scheme

(display "Hello World!")
Enter fullscreen mode Exit fullscreen mode
Collapse
 
artydev profile image
artydev β€’

Nice presentation :-)
You could be interested by Rosetta Code

Regards

Collapse
 
szabgab profile image
Gabor Szabo β€’

Groovy:

println "Hello World"
Enter fullscreen mode Exit fullscreen mode

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more