以下是用不同编程语言写成的Hello World程序的列表:
的正確輸出示範]]
打印到终端
ActionScript
trace("Hello, world!");
Ada
with TEXT_IO;
procedure HELLO is
begin
TEXT_IO.PUT_LINE ("Hello, world!");
end HELLO;
XAML
Click Here
接著使用 C# 建置
using System;
using System.Windows;
using System.Windows.Controls;
namespace XAMLSample
{
public partial class Page1 : Page
{
void HelloWorld(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello, world!");
}
}
}
易语言
.版本 2
.程序集 窗口程序集1
.子程序 __启动窗口_创建完毕
信息框 (“Hello, World!”, 0, )
服务器端
以下为Web服务端示例程序,程序启动后,需要用浏览器访问特定地址来查看结果。
ASP
:或者簡單地寫成:
HTML
Hello World
Hello World
Hello World
Go
package main
import (
"fmt"
"net/http"
)
func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "hello world")
}
func main() {
http.HandleFunc("/", helloHandler)
http.ListenAndServe("0.0.0.0:8000", nil)
}
JSP
或者简单地写成:
JavaScript
以下为Node.js环境:
const http = require('http');
http.createServer((request, response) => {
response.writeHead(200, { 'Content-Type': 'text/plain' });
response.end('Hello World!');
}).listen(8000);
console.log('Server running at http://127.0.0.1:8000/');
PHP
以下代码既可以作为服务器端运行,显示在用户浏览器上,也可以在终端中直接运行,输出到终端中:
或者
參見
*Hello World
參考文獻
外部連結
*[https://github.com/leachim6/hello-world GitHub上的Hello World程序样例集]
评论 (0)