Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.
Scope and conventions
TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.
Conditions must be bool. && evaluates its right side only when the left is true; || only when the left is false. Both return bool. There is no ternary operator; if/else is an expression. match arms use =>; patterns can bind values.
Fragment
Function; static string literals outlive the call.
src/main.rs
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
fn sign(n: i32) -> &'static str { if n == 0 { "zero" } else if n > 0 { "positive" } else { "negative" }}
match is an exhaustive expression with patterns and optional guards. _ is a catch-all pattern. if let handles one interesting pattern; it does not require all alternatives to be listed.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
src/main.rs
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
let mode = "read";let label = match mode { "read" => "reader", "write" => "writer", _ => "other",};
while checks a bool condition; loop repeats indefinitely and can return a value with break expression. Labeled breaks can exit an outer loop. for/while do not provide the same arbitrary break-value facility.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
src/main.rs
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
let mut n = 3;while n > 0 { n -= 1;}let answer = loop { break 24;};