同事说他会市面上所有编程语言
同事说他会市面上所有编程语言,我把这个拿出来他哭了。
仅供娱乐,节日快乐!
Assembly – 1949
bdos equ 0005H ; BDOS entry point
start: mvi c,9 ; BDOS function: output string
lxi d,msg$ ; address of msg
call bdos
ret ; return to CCP
msg$: db 'Hello World!$'
end start
Fortran – 1957
PROGRAM Hello
WRITE (*,*) 'Hello World'
END PROGRAM Hello
Lisp – 1958
(write-line "Hello World")
Cobol – 1959
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY "Hello World"
STOP RUN.
BASIC – 1964
PRINT "Hello World"
END
Pascal – 1970
begin
writeln('Hello World')
end.
C – 1972
#include <stdio.h>
int main(void)
{
printf("Hello World");
return 0;
}
Smalltalk – 1972
Transcript show: 'Hello World'; cr.
Scheme – 1975
(display "Hello World") (newline)
SQL – 1978
select 'Hello World' from dual;
C++ – 1980
#include <iostream>
using namespace std;
int main() {
cout << "Hello World" << endl;
return 0;
}
Common Lisp – 1984
(princ "Hello World")
MATLAB – 1984
disp('Hello World')
Objective-C – 1986
#import <Foundation/Foundation.h>
int main() {
@autoreleasepool {
NSLog(@"Hello World");
}
}
Erlang – 1986
io:format("Hello world!~n").
Perl – 1987
print "Hello World\n";
TCL – 1988
puts "Hello World"
Haskell – 1990
main = putStrLn "Hello World"
HTML – 1990
<!DOCTYPE html>
<html>
<body>
<p>Hello World</p>
</body>
</html>
Python – 1991
print("Hello World")
Visual Basic – 1991
Public Sub Main()
Debug.Print "Hello World"
End Sub
Lua – 1993
print("Hello World")
Ruby – 1995
puts 'Hello World'
Java – 1995
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
JavaScript – 1995
document.write('Hello World');
PHP – 1995
<? echo "Hello World" ?>
R – 1995
cat("Hello World")
D – 1999
import std.stdio;
void main () {
writefln("Hello World");
}
C# – 2000
using System;
internal static class HelloWorld {
private static void Main() {
Console.WriteLine("Hello World");
}
}
Groovy – 2003
println "Hello World"
Scala – 2003
object HelloWorld extends App {
println("Hello World")
}
F# – 2005
printfn "Hello World"
Windows PowerShell – 2006
echo "Hello World"
Clojure – 2007
(println "Hello World")
Go – 2009
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
Rust – 2010
fn main() {
println("Hello World");
}
Dart – 2011
main() {
print('Hello World');
}
Kotlin – 2011
fun main(args: Array<String>) {
println("Hello World")
}
Ceylon – 2011
void hello() {
print("Hello World");
}
TypeScript – 2012
console.log("Hello World");
Julia – 2012
println("Hello World")
Elixir – 2012
IO.puts("Hello World")
Swift – 2014
print("Hello World")