|
| 1 | +## Helloworld Programs |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +We list below Helloworld programs for different programming languages, i.e. programs that print "Hello, World!". |
| 6 | +The specified compiler or interpreter is requried for each programming languages. |
| 7 | + |
| 8 | +The table below smmarizes the programs: |
| 9 | + |
| 10 | +| Language | Language (Spec) Site | Section | Build / Run Toolchain | Debian / Ubuntu Packages | |
| 11 | +| --------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------- | --------------------- | ------------------------ | |
| 12 | +| C | [The Standard - C](https://www.iso-9899.info/wiki/The_Standard) | [C](#c) | GCC | `build-essential` | |
| 13 | +| C++ | [The Standard - C++](https://isocpp.org/std/the-standard) | [C++](#c++) | GCC / G++ | `build-essential`, `g++` | |
| 14 | +| Dlang | [D Programming Language: Home](https://dlang.org/) | [Dlang](#dlang) | GCC / GDC | `build-essential`, `gdc` | |
| 15 | +| Go | [The Go Programming Language](https://go.dev/) | [Go](#go) | Go | `golang` | |
| 16 | +| Rust | [Rust Programming Language](https://www.rust-lang.org/) | [Rust](#rust) | Rust (Crate) | `rustlang` | |
| 17 | +| Java | [Java Programming Language](https://docs.oracle.com/javase/8/docs/technotes/guides/language/) | [Java](#java) | JDK | `openjdk-17-jdk` | |
| 18 | +| x86_64 assembly | [x86 and amd64 instruction reference](https://www.felixcloutier.com/x86/) | [x86_64 Assembly](#x86_64-assembly) | GCC / GAS | `build-essential` | |
| 19 | +| ARM64 assembly | [Arm A64 Instruction Set Architecture](https://developer.arm.com/documentation/ddi0596/latest/) | [ARM64 Assembly](#arm64-assembly) | GCC / GAS (AArch64) | `build-essential` | |
| 20 | +| Bash | [Bash Reference Manual](https://www.gnu.org/s/bash/manual/bash.html) | [Bash](#bash) | Bash | `bash` | |
| 21 | +| Python | [Welcome to Python.org](https://www.python.org/) | [Python](#python) | Python | `python` | |
| 22 | +| Ruby | [Ruby Programming Language](https://www.ruby-lang.org/en/) | [Ruby](#ruby) | Ruby | `ruby` | |
| 23 | +| PHP | [PHP: Hypertext Preprocessor](https://www.php.net/) | [PHP](#php) | PHP | `php` | |
| 24 | +| Perl | [The Perl Programming Language](https://www.perl.org/) | [Perl](#perl) | Perl | `perl` | |
| 25 | +| Lua | [The Programming Language Lua](https://www.lua.org/) | [Lua](#lua) | Lua | `lua` | |
| 26 | + |
| 27 | +## C |
| 28 | + |
| 29 | +```C |
| 30 | +#include <stdio.h> |
| 31 | + |
| 32 | +int main(void) |
| 33 | +{ |
| 34 | + puts("Hello, World!"); |
| 35 | + return 0; |
| 36 | +} |
| 37 | +``` |
| 38 | +
|
| 39 | +Build with: |
| 40 | +
|
| 41 | +```console |
| 42 | +gcc -Wall -o helloworld helloworld.c |
| 43 | +``` |
| 44 | + |
| 45 | +Run with: |
| 46 | + |
| 47 | +```console |
| 48 | +./helloworld |
| 49 | +``` |
| 50 | + |
| 51 | +## C++ |
| 52 | + |
| 53 | +```c++ |
| 54 | +#include <iostream> |
| 55 | +int main() |
| 56 | +{ |
| 57 | +std::cout << "Hello, World!" << std::endl; |
| 58 | +return 0; |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +Build with: |
| 63 | + |
| 64 | +```console |
| 65 | +g++ -Wall -o helloworld helloworld.cpp |
| 66 | +``` |
| 67 | + |
| 68 | +Run with: |
| 69 | + |
| 70 | +```console |
| 71 | +./helloworld |
| 72 | +``` |
| 73 | + |
| 74 | +## Dlang |
| 75 | + |
| 76 | +```dlang |
| 77 | +import std.stdio; |
| 78 | +
|
| 79 | +void main() |
| 80 | +{ |
| 81 | + writeln("Hello, World!"); |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +Build with: |
| 86 | + |
| 87 | +```console |
| 88 | +gdc -Wall -o helloworld helloworld.cpp |
| 89 | +``` |
| 90 | + |
| 91 | +Run with: |
| 92 | + |
| 93 | +```console |
| 94 | +./helloworld |
| 95 | +``` |
| 96 | + |
| 97 | +## Go |
| 98 | + |
| 99 | +```go |
| 100 | +package main |
| 101 | + |
| 102 | +import "fmt" |
| 103 | + |
| 104 | +func main() { |
| 105 | + fmt.Println("Hello, World!") |
| 106 | +} |
| 107 | +``` |
| 108 | + |
| 109 | +Build and run with: |
| 110 | + |
| 111 | +```console |
| 112 | +go run helloworld.go |
| 113 | +``` |
| 114 | + |
| 115 | +## Rust |
| 116 | + |
| 117 | +```rs |
| 118 | +fn main() { |
| 119 | + println!("Hello, World"); |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +Build with: |
| 124 | + |
| 125 | +```console |
| 126 | +rustc hello.rs |
| 127 | +``` |
| 128 | + |
| 129 | +Run with: |
| 130 | + |
| 131 | +```console |
| 132 | +./helloworld |
| 133 | +``` |
| 134 | + |
| 135 | +## Java |
| 136 | + |
| 137 | +```java |
| 138 | +public class HelloWorld { |
| 139 | + public static void main(String[] args) { |
| 140 | + System.out.println("Hello, World!"); |
| 141 | + } |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +Build with: |
| 146 | + |
| 147 | +```console |
| 148 | +javac HelloWorld.java |
| 149 | +``` |
| 150 | + |
| 151 | +Run with: |
| 152 | + |
| 153 | +```console |
| 154 | +java HelloWorld |
| 155 | +``` |
| 156 | + |
| 157 | +## x86_64 Assembly |
| 158 | + |
| 159 | +```as |
| 160 | +
|
| 161 | +``` |
| 162 | + |
| 163 | +Build with: |
| 164 | + |
| 165 | +```console |
| 166 | +TODO |
| 167 | +``` |
| 168 | + |
| 169 | +Run with: |
| 170 | + |
| 171 | +```console |
| 172 | +./helloworld |
| 173 | +``` |
| 174 | + |
| 175 | +TODO |
| 176 | + |
| 177 | +## ARM64 Assembly |
| 178 | + |
| 179 | +```as |
| 180 | +
|
| 181 | +``` |
| 182 | + |
| 183 | +Build with: |
| 184 | + |
| 185 | +```console |
| 186 | +TODO |
| 187 | +``` |
| 188 | + |
| 189 | +Run with: |
| 190 | + |
| 191 | +```console |
| 192 | +./helloworld |
| 193 | +``` |
| 194 | + |
| 195 | +## Bash |
| 196 | + |
| 197 | +```bash |
| 198 | +echo "Hello, World!" |
| 199 | +``` |
| 200 | + |
| 201 | +Run with: |
| 202 | + |
| 203 | +```console |
| 204 | +bash helloworld.sh |
| 205 | +``` |
| 206 | + |
| 207 | +## Python |
| 208 | + |
| 209 | +```py |
| 210 | +print("Hello, World!") |
| 211 | +``` |
| 212 | + |
| 213 | +Run with: |
| 214 | + |
| 215 | +```console |
| 216 | +python helloworld.py |
| 217 | +``` |
| 218 | + |
| 219 | +## Ruby |
| 220 | + |
| 221 | +```rb |
| 222 | +puts "Hello, World!" |
| 223 | +``` |
| 224 | + |
| 225 | +Run with: |
| 226 | + |
| 227 | +```console |
| 228 | +ruby helloworld.rb |
| 229 | +``` |
| 230 | + |
| 231 | +## PHP |
| 232 | + |
| 233 | +```php |
| 234 | +<?php |
| 235 | +echo "Hello, World!" |
| 236 | +?> |
| 237 | +``` |
| 238 | + |
| 239 | +Run with: |
| 240 | + |
| 241 | +```console |
| 242 | +./helloworld |
| 243 | +``` |
| 244 | + |
| 245 | +## Perl |
| 246 | + |
| 247 | +```pl |
| 248 | +print("Hello, World!\n") |
| 249 | +``` |
| 250 | + |
| 251 | +Run with: |
| 252 | + |
| 253 | +```console |
| 254 | +perl helloworld.pl |
| 255 | +``` |
| 256 | + |
| 257 | +## Lua |
| 258 | + |
| 259 | +```lua |
| 260 | +print("Hello, World!") |
| 261 | +``` |
| 262 | + |
| 263 | +Run with: |
| 264 | + |
| 265 | +```console |
| 266 | +lua helloworld.lua |
| 267 | +``` |
0 commit comments