Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@
*.exe
*.out
*.app

# Python cache
__pycache__/
*.pyc
.pytest_cache/
5 changes: 5 additions & 0 deletions HelloWorld.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
7 changes: 4 additions & 3 deletions HelloWorld.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
public class Helloworld{
public static void main(String[] args){
System.out.println("Hello,World!");
public class HelloWorld {
public static void main(String[] args) {
// Print the traditional greeting.
System.out.println("Hello, World!");
}
}
4 changes: 3 additions & 1 deletion HelloWorld.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/python3
print("Hello,world!")
"""Simple Hello World script."""

print("Hello, World!")
1 change: 1 addition & 0 deletions HelloWorld.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Hello, World!'
3 changes: 3 additions & 0 deletions HelloWorld.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, World!");
}
3 changes: 2 additions & 1 deletion HelloWorld.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Imports System

Module HelloWorld
Sub Main(args As String())
Console.WriteLine("Hello World!")
' Display the greeting.
Console.WriteLine("Hello, World!")
End Sub
End Module
82 changes: 80 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,80 @@
# Hello-World-
My first repository in Github
# Hello World Collection

[English](README.md) | [中文](README.zh.md)

A curated set of minimal programs that print **"Hello, World"** in a variety of programming languages. This repository is useful for quick syntax lookups or verifying that a toolchain is configured correctly.

## Supported languages

- **C** – `HelloWorld.c`
- **C#** – `HelloWorld.cs`
- **C++** – `Helloworld.cpp`
- **Java** – `HelloWorld.java`
- **Python** – `HelloWorld.py`
- **Visual Basic** – `HelloWorld.vb`
- **TypeScript** – `Helloworld.ts`
- **Go** – `HelloWorld.go`
- **Ruby** – `HelloWorld.rb`
- **Rust** – `HelloWorld.rs`

## Running the examples
Each example is a single file that prints `Hello, World!` to standard output. Compile or interpret the file using the toolchain for that language:

### C
```bash
gcc HelloWorld.c -o hello && ./hello
```

### C#
```bash
csc HelloWorld.cs && ./HelloWorld.exe
```

### C++
```bash
g++ Helloworld.cpp -o hello && ./hello
```

### Java
```bash
javac HelloWorld.java && java HelloWorld
```

### Python
```bash
python3 HelloWorld.py
```

### Visual Basic
```bash
vbnc HelloWorld.vb && mono HelloWorld.exe
```

### TypeScript
```bash
tsc Helloworld.ts && node Helloworld.js
```

### Go
```bash
go run HelloWorld.go
```

### Ruby
```bash
ruby HelloWorld.rb
```

### Rust
```bash
rustc HelloWorld.rs && ./HelloWorld
```

## Contributing

Feel free to submit pull requests that add new languages or improve existing examples.

## License

This project is licensed under the [MIT License](LICENSE).

81 changes: 81 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Hello World 集合

[English](README.md) | 中文

一组经过精心整理的最小程序集合,演示如何在多种编程语言中输出 **"Hello, World"**。此仓库可用于快速查阅语法或验证工具链是否配置正确。

## 支持的语言

- **C** – `HelloWorld.c`
- **C#** – `HelloWorld.cs`
- **C++** – `Helloworld.cpp`
- **Java** – `HelloWorld.java`
- **Python** – `HelloWorld.py`
- **Visual Basic** – `HelloWorld.vb`
- **TypeScript** – `Helloworld.ts`
- **Go** – `HelloWorld.go`
- **Ruby** – `HelloWorld.rb`
- **Rust** – `HelloWorld.rs`

## 运行示例

每个示例都是一个输出 `Hello, World!` 到标准输出的单文件程序。根据所使用的语言,使用其相应的工具链来编译或解释:

### C
```bash
gcc HelloWorld.c -o hello && ./hello
```

### C#
```bash
csc HelloWorld.cs && ./HelloWorld.exe
```

### C++
```bash
g++ Helloworld.cpp -o hello && ./hello
```

### Java
```bash
javac HelloWorld.java && java HelloWorld
```

### Python
```bash
python3 HelloWorld.py
```

### Visual Basic
```bash
vbnc HelloWorld.vb && mono HelloWorld.exe
```

### TypeScript
```bash
tsc Helloworld.ts && node Helloworld.js
```

### Go
```bash
go run HelloWorld.go
```

### Ruby
```bash
ruby HelloWorld.rb
```

### Rust
```bash
rustc HelloWorld.rs && ./HelloWorld
```

## 贡献

欢迎提交 Pull Request 以添加新语言或改进现有示例。

## 许可证

本项目使用 [MIT 许可证](LICENSE)。

8 changes: 8 additions & 0 deletions tests/test_hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import subprocess
import sys
from pathlib import Path

def test_python_hello_output():
script = Path(__file__).resolve().parents[1] / 'HelloWorld.py'
result = subprocess.run([sys.executable, str(script)], capture_output=True, text=True, check=True)
assert result.stdout.strip() == 'Hello, World!'