# 代码示例
# Python 3
print("Hello, World!")
# Node.js
console.log("Hello, World!")
# Lua
print("Hello, World!")
# C++
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << endl;
return 0;
}
# C#
using System;
namespace HelloWorldApplication
{
class HelloWorld
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Console.ReadKey();
}
}
}
# C
#include <stdio.h>
int main()
{
printf("Hello, World! \n");
return 0;
}
# Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
注意
类名必须为 Main。
# PHP
<?php
echo "Hello, World!";
?>
# Kotlin
fun main() {
println("Hello, World!")
}
# Kotlin Script
println("Hello, World!")
# Rust
fn main() {
println!("Hello, World!");
}
# Golang
package main;
import "fmt";
func main() {
fmt.Println("Hello, World!");
}
# F#
printfn "Hello, World!"
# R
print("Hello, World!")
# Pascal
program Hello;
begin
writeln ('Hello, world!')
end.
# Lisp
(write-line "Hello, World")
# Erlang
% escript will ignore the first line
main(_) ->
io:format("Hello, World!~n").
# Swift
print("Hello, World!")
# Brainfuck
>++++++++++[<+++++++>-]<++.>++++++++++[<++>-]<+++++++++.+++++++..+++.>++++++++++[<------>-]<-------.>++++++++++[<->-]<--.>++++++++++[<+++++>-]<+++++.>++++++++++[<++>-]<++++.+++.------.--------.>++++++++++[<------>-]<-------.
# Groovy
println 'Hello, World!'
# Bash
echo "Hello, World!"
# NASM(64 位)
segment .data
msg db "Hello, world!", 0xA
len equ $ - msg
section .text
global _start
_start:
mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80
mov ebx, 0
mov eax, 1
int 0x80