📅  最后修改于: 2023-12-03 14:38:51.902000             🧑  作者: Mango
在计算机科学中,“Hello World”通常是编程最基本的示例程序之一,它用于演示编程语言的基础语法和结构。以下是 30 种不同语言的 "Hello World" 程序示例。
#include <stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
#include <iostream>
int main() {
std::cout << "Hello, world!";
return 0;
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
print("Hello, world!")
console.log("Hello, world!");
console.log("Hello, world!");
puts "Hello, world!"
<?php
echo "Hello, world!";
?>
print("Hello, world!")
fn main() {
println!("Hello, world!");
}
fun main() {
println("Hello, world!")
}
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
print("Hello, world!")
print("Hello, world!")
println("Hello, world!")
print "Hello, world!\n";
#!/bin/bash
echo "Hello, world!"
Write-Host "Hello, world!"
SELECT 'Hello, world!'
global _start
section .text
_start:
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov eax,1
xor ebx,ebx
int 0x80
section .data
msg db 'Hello, world!',0xa
len equ $ - msg
void main() {
print("Hello, world!");
}
IO.puts "Hello, world!"
(write-line "Hello, world!")
print_endline "Hello, world!"
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line("Hello, world!");
end Hello;
println("Hello, world!")
puts "Hello, world!"
class Main {
static function main() {
trace("Hello, world!");
}
}
@import 'sass:meta';
@function hello($name: "world") {
@return "Hello, #{$name}!";
}
body:before {
content: hello();
}
上述示例展示了许多不同的编程语言,每种语言都有其特定的语法和结构。这个列表只是编程世界中的点缀,其中还有许多其他语言值得探索。Happy coding!