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.
if tests a value convertible to bool. Built-in &&/|| short-circuit and return bool: && skips the right side when the left is false; || skips it when true. Overloaded operators do not short-circuit. condition ? a : b evaluates only the selected branch.
Fragment
Fragment inside a function.
main.cpp
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const int n = 4;if (n == 0) { // zero} else if (n > 0) { // positive}
A range-for visits elements; a three-part for can count or repeat indefinitely. String iteration visits char units, not decoded Unicode characters. break exits the loop.
Fragment
Header at file scope; loop statements inside a function.
main.cpp
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
#include <string>for (char ch : std::string("west")) {}for (int i = 0; i < 2; ++i) {}for (;;) { break;}
switch works with suitable integral/enum conditions, not ordinary strings. Cases can fall through without an exit; [[fallthrough]] documents intent. C++23 does not have Rust-style general match syntax.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.