Github上流行的开源编程语言

666 阅读1分钟

😜 水一篇文章应该不过分吧!

排名发布年份语言Star/k项目地址
12009Go76.7github.com/golang/go
22012TypeScript64.4github.com/microsoft/T…
32014Swift53.5github.com/apple/swift
42010Rust48.3github.com/rust-lang/r…
51991Python33.6github.com/python/cpyt…
62011Kotlin33.4github.com/JetBrains/k…
72012Julia29.4github.com/JuliaLang/j…
81995PHP28.2github.com/php/php-src
91993Ruby17.3github.com/ruby/ruby

2009 — Go

// 模块初始化: go mod init main
// 编译: go build -o main main.go

package main

import "fmt"

func Hello(s string) string {
    return "Hello " + s
}

func main() {
    str := Hello("World")
    fmt.Printf("%s\n", str)
}

2012 — TypeScript

// 编译成JS: tsc main.ts
// 解释执行: node main.js

function Hello(s: string) {
    return `Hello ${s}`
}

let str: string = Hello("World")
console.log(str)

2014 — Swift

// 生成项目: swift package init --type executable
// 编译: swift build --build-path bin

func Hello(s: String) -> String {
    return "Hello " + s
}

let str = Hello(s: "World")
print(str)

2010 — Rust

// 生成项目: cargo new main_rs
// 编译: cargo build

fn hello(s: String) -> String {
    return "Hello ".to_string() + &s;
}

fn main() {
    let str = hello("World".to_string());
    println!("{}", str.to_string());
}

1991 — Python

# 解释执行: python3 main.py

def Hello(s):
    return "Hello " + s

str = Hello("World")
print(str)

2011 — Kotlin

// 编译成中间文件: kotlinc main.kt
// 解释执行: kotlin MainKt

fun Hello(s: String): String {
    return "Hello $s"
}

fun main() {
    val str = Hello("World")
    println(str)
}

2012 — Julia

# 解释执行: julia main.jl

function hello(s)
    return string("Hello ", s)
end

str = hello("World")
println(str)

1995 — PHP

<?php
// 解释执行: php main.php

function Hello($s)
{
    return "Hello " . $s;
}

$str = Hello("World");
echo $str . "\n";

1993 — Ruby

# 解释执行: ruby main.ru

def Hello(s)
    puts "Hello " + s
end

str = Hello("World")
puts str