開源最前線(ID:OpenSourceTop)編譯
鏈接:https://github.com/leachim6/hello-world
500+種編程語言寫的“hello world”你見過麼?你會幾個?


幾乎每個程序員寫出來的第一個程序都是“hello world”,Hello World最早是由 Brian Kernighan 創建的。1978年,Brian Kernighan寫了一本名叫《C程序設計語言》的編程書,在程序員中廣爲流傳。他在這本書中第一次引用的Hello World程序:

main (){
  extrn a,b,c;
  putchar (a); putchar (b); putchar (c); putchar ('!*n');
  }
  a 'hell';
  b 'o, w';
  c 'orld';


之後“Hello world”就開始流行起來,併成爲了計算機發展歷史上一個具有重要意義的里程碑。


最近猿妹在GitHub上發現了一個十分有趣的開源項目,它彙集了500多種編程語言編寫的“Hello world”程序。


500+種編程語言寫的“hello world”你見過麼?你會幾個?



這個項目名稱就叫hello-world,目前已經獲得3241個Star,959個Fork(GitHub地址:https://github.com/leachim6/hello-world),下面我們先看幾個過過癮:


Ada:

with Text_IO;
procedure Hello_World is
begin
Text_IO.Put_line("Hello World!");
end Hello_World;


Android:

package com.example.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, World");
setContentView(tv);
}
}


Bash:

#!/bin/bash
echo "Hello World!"


Basic:

10 REM Hello World in BASIC
20 PRINT "Hello World"


C++:

#include  // include API
using namespace std;
int main() // the main code portion of a C++ program
{
cout << "Hello World" << endl; //print Hello World on the screen
return 0; // conventional
}


Caml:

print_endline "Hello world!";;


Delphi:

program HelloWorld;
{$APPTYPE CONSOLE}
begin
WriteLn('Hello World');
end.


Dart:

main() {
print('Hello, World!');
}


Elixir:

#!/usr/bin/env elixir
IO.puts "Hello world"


erlang_escript:

#!/usr/bin/env escript
main(_) ->
io:format("Hello World~n").


Factor:

USING: io ;
"Hello World" print


Focal:

0.1.0.1 TYPE "HELLO WORLD" , !


Go:

package main
func main() {
println("Hello, World")
}


Groovy:

println "Hello World"


Hack:

echo 'Hello World';


Haskell:

module Main where
main = putStrLn "Hello, World!"


Islisp:

(format (standard-output) "Hello, world!")


Java:

public class Java {
public static void main(String[] args) {
System.out.println("Hello World");
}
}


JavaScript:

console.log("Hello World");


Lisp:

; LISP
(DEFUN hello ()
(PRINT (LIST 'HELLO 'WORLD))
)
(hello)


感興趣的想要查看所有語言的“hello world”程序,就自己到GitHub項目頁查看吧,最後奉上GitHub地址:https://github.com/leachim6/hello-world

相關文章