惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
C
Cyber Attacks, Cyber Crime and Cyber Security
SecWiki News
SecWiki News
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
H
Help Net Security
I
InfoQ
T
Tor Project blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
S
Schneier on Security
The Hacker News
The Hacker News
博客园 - Franky
雷峰网
雷峰网
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
Engineering at Meta
Engineering at Meta
G
GRAHAM CLULEY
Security Latest
Security Latest
The Cloudflare Blog
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
C
Cisco Blogs
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Latest news
Latest news
Last Week in AI
Last Week in AI
The Register - Security
The Register - Security
Google DeepMind News
Google DeepMind News
博客园 - 聂微东
T
Threatpost
G
Google Developers Blog
有赞技术团队
有赞技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
aimingoo的专栏
aimingoo的专栏
S
Securelist
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
T
The Exploit Database - CXSecurity.com
月光博客
月光博客
Recent Announcements
Recent Announcements

RisingIce

2024年终总结 | RisingIce 使用大模型总结B站视频 | RisingIce 使用Vercel搭建Umami统计 | RisingIce 部署Twikoo评论系统 | RisingIce Vercel域名被墙的问题 | RisingIce 修改anzhiyu主题的TianliGPT插件为其他大模型API | RisingIce Ubuntu挂载群晖共享文件夹与Comfyui模型迁移 | RisingIce 记一次conda环境激活却不起作用的问题及解决方法 | RisingIce 《程序员的README》- 随笔 | RisingIce
Hello Word的由来 | RisingIce
RisingIce · 2023-12-10 · via RisingIce

一、前言 ​

还记得大一刚学编程的时候,学的第一门语言是C语言,print出的第一行代码是Hello World。现在想起来记忆已经有些模糊,只记得当时配置好环境之后,跟着老师一个字母一个字母的输入进去,点击运行之后,cmd窗口弹出,第一行就是Hello World,当时忙于惊叹于计算机编程之神奇带给我的冲击,并没有细想为什么是Hello World,老师也没有过多解释。今天周末闲来无事,就去翻找了一下Wiki以及其他资料,在此做一个总结报告记录一下。

二、Hello World 的由来 ​

Hello World 最早可追溯至1973Brian Kernighan 撰写的一份内部的技术文件《A Tutorial Introduction to the Language B》中的一个示例程序:

bash

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

但让其广为流传的是1978年由Brian Kernighan 和C 语言之父 - Dennis M. Ritchie 合著的C程序设计语言,它是第一部介绍C语言编程方法的书籍,书中用"hello,world"为示例开始讲解程序设计:

在示例中,main( )函数定义了程序开始执行的位置。其主体由一条语句组成,即对printf函数的调用,意思是“打印格式化”(print formatted)。这个函数将使程序输出以参数传递给它的任何内容,在本例中是字符串hello, world。

▲布莱恩·柯尼汉在1978年用C语言手写的hello,world程序以及他个人的亲笔签名,图片来源于wiki

随着这部经典著作的大卖,"hello, world"也流行起来,逐渐成为具有特定象征意义的文化符号。

e40d54c637b88d0a5417fe82ad21a3a5.jpege40d54c637b88d0a5417fe82ad21a3a5.jpeg

▲年轻时的布莱恩·柯尼汉,图片来源网络

但是非常遗憾的是,当 Forbes India 杂志在2011年采访他的时候,他自己对这段传奇故事中一些记忆已经有点儿模糊了。当他被问及关于“hello,world”的准确来历时,他是回答时说:

我只记得,我好像看过一幅漫画,讲述一枚鸡蛋和一只小鸡的故事,在那副漫画中,小鸡说了一句 ‘Hello World’

三、目前一些流行语言的Hello World ​

Java

java

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}

Python

Python

print("Hello, World!")

C#

c#

using System;

class Program {
    static void Main(string[] args) {
        Console.WriteLine("Hello, World!");
    }
}

C++

c++

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

Ruby


Go

go

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Kotlin

kotlin

fun main() {
    println("Hello, World!")
}

Rust

rust

fn main() {
    println!("Hello, World!");
}

PHP

php

<?php
echo "Hello, World!";
?>

TypeScript

typescript

console.log("Hello, World!");

Scala

scala

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, World!")
  }
}

Erlang

erlang

io:format("Hello, World!~n").