On this page

Every new space starts somewhere. This one starts with two familiar words: Hello, world.

This article is a reading and rendering sample. It brings together small programs, public tutorial examples, and the ordinary details of a Markdown page.

A first program#

The simplest Rust program needs a function and something to say. This example comes from The Rust Programming Language.

rust
fn main() {
    println!("Hello, world!");
}

Save it as main.rs, compile it, and run the result:

bash
rustc main.rs
./main
text
Hello, world!

The same greeting, different languages#

Python#

python
def greet(name: str) -> str:
    return f"Hello, {name}!"


print(greet("world"))

JavaScript#

javascript
function greet(name) {
  return `Hello, ${name}!`;
}

console.log(greet("world"));

C#

c
#include <stdio.h>

int main(void) {
    printf("Hello, world!\n");
    return 0;
}

Bash#

bash
printf '%s\n' 'Hello, world!'

Zig#

zig
const std = @import("std");

pub fn main() void {
    std.debug.print("Hello, world!\n", .{});
}

Java#

java
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}

C++#

cpp
#include <iostream>

int main() {
    std::cout << "Hello, world!\n";
    return 0;
}

Assembly#

This example uses GNU assembler Intel syntax on x86-64 Linux.

asm
.intel_syntax noprefix
.section .rodata
message:
    .ascii "Hello, world!\n"

.section .text
.global _start
_start:
    mov eax, 1
    mov edi, 1
    lea rsi, [rip + message]
    mov edx, 14
    syscall

    mov eax, 60
    xor edi, edi
    syscall

A little more than hello#

The Python tutorial uses the Fibonacci sequence to introduce assignment and loops. The following short adaptation keeps the state visible and the output easy to check. Python documentation examples are available under the Zero Clause BSD license.

python
current, following = 0, 1

while current < 10:
    print(current)
    current, following = following, current + following

The greeting function below is adapted from the MDN JavaScript introduction. It writes to the console so the example does not need a dialog.

javascript
function greetMe(yourName) {
  console.log(`Hello ${yourName}`);
}

greetMe("World");

Reading details#

A sentence can contain emphasis, a quieter aside, an old idea, and inline code. A link should remain easy to recognize without taking attention away from the words around it.

A short quotation gives a paragraph room to breathe.

This is sample text written for this page.

A small table#

LanguageEntry pointGreeting
Rustfn main()println!
PythonModule executionprint
JavaScriptScript executionconsole.log
Cint main(void)printf
BashScript executionprintf
Zigpub fn main()std.debug.print
Javapublic static void mainSystem.out.println
C++int main()std::cout
Assembly_startLinux write syscall

Lists and tasks#

  1. Read the example.
  2. Copy the code.
  3. Run it in a suitable local environment.
  • Keep functions small.

  • Give values useful names.

    • Let indentation show the structure.
    • Explain a decision when a comment helps.
  • A first article

  • Examples in several languages

  • More things to write

A long line#

The following line is deliberately long. It should scroll inside its code block while the article remains within the page width.

text
Hello, world! This deliberately long line keeps going so that horizontal scrolling can be checked on a narrow screen without stretching the article, moving the page edges, or reducing the code font size.

Plain text#

An unfamiliar language label should still produce a readable block.

greeting
hello -> world

Mathematics#

Mathematics can sit inside a sentence, such as E=mc2E = mc^2, or have a line of its own. Fractions, roots, and operators retain their mathematical layout:

x=−b±b2−4ac2a x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

∫−∞∞e−x2dx=π∑k=0nk=n(n+1)2 \int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi} \qquad \sum_{k=0}^{n} k = \frac{n(n+1)}{2}

Matrices and aligned equations#

(1234)(xy)=(x+2y3x+4y) \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x + 2y \\ 3x + 4y \end{pmatrix}

(a+b)2=a2+2ab+b2f(x)={x2if x≥0−xotherwise \begin{aligned} (a+b)^2 &= a^2 + 2ab + b^2 \\ f(x) &= \begin{cases} x^2 & \text{if } x \geq 0 \\ -x & \text{otherwise} \end{cases} \end{aligned}

A small macro#

Definitions can shorten a formula while keeping its meaning explicit:

∥v∥=∑i=1nvi2 \newcommand{\norm}[1]{\left\lVert #1 \right\rVert} \norm{\mathbf{v}} = \sqrt{\sum_{i=1}^{n} v_i^2}

The source stays literal in code: $E = mc^2$. An ordinary dollar sign is escaped: $25. A display formula that is wider than the screen scrolls within the article.

Words beyond English#

Hello, world. 你好,世界。こんにちは、世界。안녕하세요, 세계. Bonjour, le monde.

مرحبًا بالعالم.

Accented letters and combining marks belong in the same reading experience: café, naïve, résumé, café. A small wave belongs here too: 👋.

One last detail#

Footnotes can carry an aside without interrupting a paragraph.1 The headings on this page also provide direct links for the table of contents.

1

This footnote is part of the Markdown rendering sample.


That is enough for a beginning. Hello, world.