Table of contents
Introduction
When you plan to start learning a programming language, the very first program would most possibly to display "Hello, World!".
Let's see how can we write it in 30 different languages.
Let's Go!!!
➊ C
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
➋ C++
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!";
return 0;
}
➌ Java
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
➍ C#
Console.WriteLine("Hello, World!");
➎ HTML
<!DOCTYPE html>
<html>
<body>
Hello, World!
</body>
</html>
➏ CSS
body::before{
content: "Hello, World!";
}
➐ JavaScript
console.log('Hello, World!');
➑ Python
print('Hello, World!')
➒ PHP
<?php
echo "Hello, World!";
➓ Rust
fn main() {
println!("Hello, World!");
}
➊➊ Objective-C
#import <Foundation/Foundation.h>
int main(int argc, char * argv[]) {
NSLog(@"Hello, World!");
return 0;
}
➊➋ Swift
print("Hello, World!")
➊➌ Kotlin
fun main(args : Array<String>) {
println("Hello, World!")
}
➊➍ Dart
void main(){
print("Hello, World!");
}
➊➎ Ruby
puts "Hello, World!"
➊➏ Groovy
println "Hello, World!"
➊➐ R
print("Hello, World!")
➊➑ MATLAB
disp('Hello, World!')
➊➒ Lua
print("Hello, World!")
20. Pascal
program Hello;
begin
writeln ('Hello, World!');
end.
➋➊ Haskell
main = putStrLn "Hello, World!"
➋➋ Julia
println("Hello, World!")
➋➌ Perl
print("Hello, World");
➋➍ Elixir
IO.puts("Hello, World!")
➋➎ Golang
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
➋➏ Clojure
(ns clojure.examples.hello
(:gen-class))
(defn hello-world []
(println "Hello World"))
➋➐ PL/SQL
BEGIN
dbms_output.put_line(‘Hello, World!');
END;
/
➋➑ Bash
echo "Hello, World!"
➋➒ Power Shell
Write-Host 'Hello, World!'
30. Solidity
pragma solidity >=0.5.0 <0.7.0;
contract HelloWorld {
function get() public pure returns (string memory) {
return 'Hello, World!';
}
}
Final Words
I hope these code snippets would have given you an overall idea about the similarities and diversities among all these programming languages. And, I am hopeful that this article would help you to start in any of these languages.
Do you find this helpful? Please give your valuable feedbacks.