Programming languages,
side by side.
Everyday syntax and editor commands in one quick reference.
/
Scripting
| Topic | Python | JavaScript | TypeScript |
|---|---|---|---|
| Run a file | | | |
| Variable | | | |
| | | |
| String interpolation | | | |
| List | | | |
| Dictionary / map | | | |
| Define a function | | | |
| Loop over values | | | |
| Keep matching values | | | |
| Parse JSON | | | |
| Read a UTF-8 file | | | |
JavaScript command-line examples use Node.js. The TypeScript launch command uses tsx. The file-reading examples use ECMAScript modules.
Systems
| Topic | C++ | Go | Rust |
|---|---|---|---|
| Build or run | | | |
| Variable | | | |
| | | |
| String interpolation | | | |
| List | | | |
| Dictionary / map | | | |
| Define a function | | | |
| Loop over values | | | |
| Optional value | | | |
| Read a UTF-8 file | | | |
Snippets omit imports, headers and program entry points. The Go and Rust file snippets assume an enclosing function that can return an error. C++ and Go read bytes in these examples.
Application languages
| Topic | Java | C# |
|---|---|---|
| Run | | |
| Variable | | |
| | |
| String interpolation | | |
| List | | |
| Dictionary / map | | |
| Define a function | | |
| Loop over values | | |
| Keep matching values | | |
| Read a UTF-8 file | | |
Java examples use modern JDK syntax. The C# run command assumes a .NET project. Some examples require standard-library imports.
Text editors
| Topic | Vim | Emacs |
|---|---|---|
| Open a file from the shell | | |
| Open a file inside the editor | | |
| Enter text | | |
| Save | | |
| Quit | | |
| Search forward | | |
| Replace throughout the file | | |
| Go to line 42 | | |
| Select text | | |
| Copy a selection | | |
| Paste | | |
| Undo | | |
| Split into side-by-side panes | | |
Vim commands start in Normal mode. In Emacs, C means Control and M usually means Alt. RET is Enter. For a full-buffer replacement in Emacs, start at the beginning of the buffer.