Polyglot Primer

Polyglot Primer

Go, Java, JavaScript and Python side by side.

A quick side-by-side refresher of Go, Java, JavaScript and Python: syntax tables, quirks, what is idiomatic in each, a checklist and exercises per chapter. Core language and standard library only.

Chapters

  1. Chapter 1: Program Basics
    Hello world, how each language runs code, where main lives, comments, and the naming/formatting culture of each. Versions assumed: Go 1.22+, Java 21,...
  2. Chapter 2: Variables, Constants and Types
    How to declare things, what the built-in types are, what "nothing" looks like, and how each language treats conversion, equality and operators.
  3. Chapter 3: Strings and Text
    Strings are immutable in all four languages, but what a "character" is differs sharply: bytes (Go), UTF-16 units (Java, JS) or code points (Python).
  4. Chapter 4: Control Flow
    Branching and looping. Go has the fewest keywords (one loop, for); Java and JavaScript have the most (for, while, do/while, enhanced for); Python has...
  5. Chapter 5: Functions
    Declaring, calling and passing functions. Go returns multiple values and uses them for errors; JS and Python treat functions as ordinary values with rich...
  6. Chapter 6: Collections - Arrays, Lists, Maps and Sets
    The workhorse data structures. Go has just arrays, slices and maps built into the language; Java ships a full Collections Framework; JS has arrays, objects,...

How each chapter works