Skip to content

Instantly share code, notes, and snippets.

@tigranbs
Last active March 12, 2017 14:02
Show Gist options
  • Select an option

  • Save tigranbs/15ab164a56fc05eb6d727e833e03cc54 to your computer and use it in GitHub Desktop.

Select an option

Save tigranbs/15ab164a56fc05eb6d727e833e03cc54 to your computer and use it in GitHub Desktop.
"Hello World in Top 15 Programming Languages"

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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment