Few days ago I saw top languages from Github activities https://octoverse.github.com/
Top 15 Programming Languages in Github.com
This gave me an idea “What it would be look like to make very minimal examples of all that languages in the same page?”. Seems crazy right? And that’s why I’ve done it!
1. JavaScript
console.log("Hello World!");
2. Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
3. Python
# Python 2
print "Hello World!"
# Python 3
print("Hello World!")
4. Ruby
puts 'Hello World!'
5. PHP
echo 'Hello World';
6. C++
#include <iostream>
int main()
{
std::cout << "Hello World!";
}
7. CSS
<style type="text/css">
h1 {
color: DeepSkyBlue;
}
</style>
<h1>Hello World!</h1>
8. C#
using System;
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello World!");
}
}
9. C
#include<stdio.h>
main()
{
printf("Hello World!");
}
10. Go
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
11. Shell
#!/bin/bash
echo "Hello World!"
12. Objective C
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Hello World!");
[pool drain];
return 0;
}
13. Scala
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello World!")
}
}
14. Swift
print("Hello World!")
15. TypeScript
class HelloWorld {
constructor(public greeting: string) { }
sayHello() {
return "<h1>" + this.greeting + "</h1>";
}
};
var greeter = new HelloWorld("Hello World!");
console.log(greeter.greet());
You successfully scrolled to the bottom :)
I wanted to point out the specific key point of each programming language, because when you are first starting with one of them you probably going to write Hello World! example just to see how it look like writing a code with that language and how actually it behaves as a final result.
Even from this simple list you can see which of that languages focused on simplicity. Personally I prefer JS, Go, Python and Rust(not in the list) but they all for different tasks of course. But for “Hello World!” example they all playing very well.