Language Basics
Introduction
This pages is to list terms on one page to help an old man
Programming Language Basics
This page defines foundational terms used across programming languages, with examples to support onboarding and cross-language understanding.
Expression
A combination of values, variables, and operators that evaluates to a result.
Example: 3 + 4 * 2 → evaluates to 11
Statement
A complete instruction that performs an action.
Example: let total = 3 + 4 * 2; → assigns 11 to total
Parameter
A variable passed into a function definition.
Example: function greet(name) { console.log("Hello " + name); }
Argument
The actual value passed to a function when it’s called.
Example: greet("Iain") → "Iain" is the argument
Variable
A named storage location for data.
Example: let age = 42;
Function
A reusable block of code that performs a task.
Example: function square(x) { return x * x; }
Return
Sends a value back from a function.
Example: return x * x;
Condition
A logical test that controls flow.
Example: if (age > 18) { console.log("Adult"); }
Loop
Repeats a block of code while a condition is true.
Example: for (let i = 0; i < 5; i++) { console.log(i); }
Operator
A symbol that performs a computation.
Examples: +, -, *, /, ==, &&, ||
Type
Defines the kind of data (e.g., number, string, boolean).
Example: let name: string = "Iain";
Scope
The context in which a variable or function is accessible.
Example: Variables inside a function are not accessible outside it.
Array
A list-like structure to store multiple values.
Example: let colors = ["red", "green", "blue"];
Object
A collection of key-value pairs.
Example: let user = { name: "Iain", age: 42 };
Class
A blueprint for creating objects (OOP).
Example: class Song { constructor(title) { this.title = title; } }
Method
A function attached to an object or class.
Example: user.sayHello = function() { console.log("Hi!"); }
Module
A file or unit of code that can be imported/exported.
Example: import { square } from './math';
Import / Export
Mechanisms to share code between files.
Example: export function greet() {} and import { greet } from './utils';