Programming language reference

Keywords

Look up reserved words and common language tokens, with a clear explanation of what each one does.

JavaScript

const

Declares a block-scoped binding that cannot be reassigned.

JavaScript

let

Declares a block-scoped variable that can be reassigned.

JavaScript

var

Declares a function-scoped variable; avoid it in new code because its scope and hoisting can surprise.

JavaScript

function

Declares a function that can be called to run reusable code.

JavaScript

return

Ends a function and optionally sends a value back to its caller.

JavaScript

async

Marks a function so it returns a Promise and can use await.

JavaScript

await

Waits for a Promise to settle inside an async function or module.

JavaScript

class

Declares a class used to create objects and define methods.

JavaScript

extends

Creates a class that inherits from another class.

JavaScript

new

Creates an instance from a constructor or class.

JavaScript

this

Refers to the current call context; its value depends on how a function is called.

JavaScript

super

Calls or accesses the parent class constructor and methods.

JavaScript

import

Brings exported values from another module into this module.

JavaScript

export

Makes values available for other modules to import.

JavaScript

try

Starts a block whose thrown errors can be handled.

JavaScript

catch

Handles an error thrown from a matching try block.

JavaScript

finally

Runs cleanup code after try/catch, whether or not an error occurred.

JavaScript

throw

Raises an exception that interrupts normal execution.

JavaScript

typeof

Returns a string describing the type of a value.

JavaScript

instanceof

Checks whether an object inherits from a constructor's prototype.

JavaScript

for

Starts a loop that repeats while its condition or iterator rules allow.

JavaScript

of

Iterates over values from an iterable, commonly in a for...of loop.

JavaScript

in

Checks property membership or iterates over enumerable object keys.

JavaScript

if

Runs a block only when its condition is truthy.

JavaScript

else

Provides the alternative branch when an if condition is false.

JavaScript

switch

Selects a branch by comparing an expression with case values.

JavaScript

break

Exits the nearest loop or switch statement.

JavaScript

continue

Skips to the next iteration of the nearest loop.

JavaScript

delete

Removes an object's own property.

JavaScript

void

Evaluates an expression and returns undefined; often seen in older code.

Python

def

Defines a function.

Python

class

Defines a class, a blueprint for creating objects.

Python

return

Ends a function and optionally returns a value.

Python

if

Runs a block when a condition is true.

Python

elif

Checks another condition when earlier if/elif conditions were false.

Python

else

Runs the fallback branch when preceding conditions are false.

Python

for

Iterates over items from an iterable.

Python

while

Repeats a block while a condition remains true.

Python

break

Exits the nearest loop immediately.

Python

continue

Skips the rest of the current loop iteration.

Python

try

Starts a block where exceptions can be handled.

Python

except

Catches matching exceptions raised in a try block.

Python

finally

Runs cleanup code whether an exception occurred or not.

Python

raise

Raises an exception.

Python

with

Runs a block within a context manager, which handles setup and cleanup.

Python

as

Assigns an alias, such as a context manager target or imported name.

Python

import

Loads a module or names from a module.

Python

from

Specifies the module from which names are imported.

Python

lambda

Creates a small anonymous function expression.

Python

yield

Produces a value from a generator while preserving its execution state.

Python

async

Defines an asynchronous function or context.

Python

await

Suspends an async function until an awaitable completes.

Python

pass

Does nothing; used as a placeholder where a statement is required.

Python

assert

Raises AssertionError if a condition is false; useful for checks during development.

Python

del

Removes a name, item, or object attribute binding.

Python

global

Declares that assignments in a function refer to a module-level name.

Python

nonlocal

Declares that assignments refer to a name in an enclosing function scope.

Python

in

Tests membership or appears in iteration syntax.

Python

is

Checks whether two references point to the same object.

Python

and

Returns a truthy/falsy operand based on whether both conditions are true.

Python

or

Returns a truthy/falsy operand based on whether either condition is true.

Python

not

Negates a truth value.

Python

None

The singleton value representing the absence of a value.

Python

True

The Boolean value for true.

Python

False

The Boolean value for false.

TypeScript

interface

Defines the expected shape of an object or class contract.

TypeScript

type

Creates a name for a type, including unions, intersections, and object shapes.

TypeScript

enum

Defines a named set of related constant values.

TypeScript

implements

Declares that a class satisfies a specified interface.

TypeScript

extends

Inherits from a class or builds a type from another type.

TypeScript

readonly

Prevents reassignment of a property or array elements through that reference.

TypeScript

keyof

Produces a union of the property names of a type.

TypeScript

typeof

Gets a value's type in JavaScript or refers to a variable's type in TypeScript type positions.

TypeScript

as

Asserts a type to the compiler or renames an import/export.

TypeScript

declare

Tells TypeScript that a value exists elsewhere, without emitting its implementation.

TypeScript

public

Allows a class member to be accessed from anywhere.

TypeScript

private

Restricts a class member to its declaring class.

TypeScript

protected

Allows access in the declaring class and its subclasses.

TypeScript

abstract

Marks a class or method as a base definition that must be completed by subclasses.

TypeScript

never

The type for values that never occur, such as a function that always throws.

TypeScript

unknown

A safe top type; values must be narrowed before use.

TypeScript

any

Disables type checking for a value; use sparingly because it removes safety.

TypeScript

infer

Introduces a type variable inside a conditional type for pattern matching.

TypeScript

satisfies

Checks that a value conforms to a type while preserving its more specific inferred type.

TypeScript

asserts

Marks a function as narrowing a condition or variable after it returns.

Java

class

Declares a class that defines object state and behavior.

Java

interface

Declares a contract that implementing classes must fulfill.

Java

extends

Inherits from a class or, for interfaces, another interface.

Java

implements

Declares that a class provides the methods required by an interface.

Java

new

Creates an object or array instance.

Java

this

Refers to the current object instance.

Java

super

Refers to the parent class, often to call its constructor or methods.

Java

static

Makes a member belong to the class rather than an instance.

Java

final

Prevents reassignment of a variable, overriding of a method, or subclassing of a class.

Java

void

Declares that a method does not return a value.

Java

return

Ends a method and optionally provides its result.

Java

if

Runs a statement when a condition is true.

Java

else

Provides an alternative branch for an if statement.

Java

switch

Selects a branch based on a value.

Java

for

Repeats statements using a loop counter or iterable.

Java

while

Repeats statements while a condition is true.

Java

try

Starts a block where exceptions may be caught or resources managed.

Java

catch

Handles a matching exception from a try block.

Java

throw

Throws an exception explicitly.

Java

throws

Declares exceptions that a method may pass to its caller.

Java

private

Limits access to the declaring class.

Java

protected

Allows access within the package and by subclasses.

Java

public

Allows access from any class that can reach the type.

Java

package

Declares the package that contains a source file.

Java

import

Makes types from other packages available by their simple names.

Java

instanceof

Tests whether an object is an instance of a type.

Java

abstract

Marks an incomplete class or method intended for subclass implementation.

Java

enum

Declares a fixed set of named constants.

Java

synchronized

Coordinates access to a block or method using an object's monitor.

Java

volatile

Ensures reads and writes to a field are visible across threads.

C++

class

Declares a class type with data and member functions.

C++

struct

Declares a class-like type whose members are public by default.

C++

namespace

Groups names to avoid collisions and organize code.

C++

template

Defines generic functions or types parameterized by compile-time values or types.

C++

typename

Identifies a dependent name as a type in a template.

C++

auto

Asks the compiler to infer a variable's type from its initializer.

C++

decltype

Produces the declared type of an expression.

C++

constexpr

Marks values or functions that can be evaluated at compile time when possible.

C++

const

Prevents modification through a particular variable or reference.

C++

static

Gives a name static storage duration or limits a file-scope name to its translation unit.

C++

virtual

Enables runtime method dispatch through a base class interface.

C++

override

Confirms that a method overrides a virtual base method.

C++

public

Makes class members accessible to any caller.

C++

private

Restricts class members to the declaring class and its friends.

C++

protected

Allows access in the class, its derived classes, and friends.

C++

new

Allocates an object dynamically and initializes it.

C++

delete

Destroys and deallocates an object created with new.

C++

try

Starts a block where thrown exceptions can be caught.

C++

catch

Handles exceptions of a matching type.

C++

throw

Raises an exception.

C++

return

Ends a function and optionally returns a value.

C++

nullptr

The null pointer literal introduced in modern C++.

C++

this

Points to the object on which a non-static member function was called.

C++

using

Introduces a name or type alias into scope.

C++

enum

Declares a set of named values; enum class provides scoped enumerators.

Go

package

Declares the package a source file belongs to.

Go

import

Makes another package available to the current file.

Go

func

Declares a function or method.

Go

var

Declares a variable with an explicit or inferred type.

Go

const

Declares a compile-time constant.

Go

type

Defines a new named type or type alias.

Go

struct

Declares a composite type that groups fields.

Go

interface

Defines a set of methods; types satisfy it implicitly by implementing them.

Go

map

Built-in keyword for declaring map types, such as map[string]int.

Go

chan

Declares a channel type for communication between goroutines.

Go

go

Starts a function call in a new goroutine.

Go

defer

Schedules a function call to run when the surrounding function returns.

Go

select

Waits on multiple channel operations and runs one that is ready.

Go

if

Runs a block when a condition evaluates to true.

Go

else

Provides an alternative branch to an if statement.

Go

for

The only loop keyword; supports traditional, condition-only, and range forms.

Go

range

Iterates over elements in arrays, slices, maps, strings, or channels.

Go

switch

Selects a matching case; Go switches do not fall through by default.

Go

case

Defines a branch in a switch or select statement.

Go

default

Defines the fallback branch in a switch or select statement.

Go

return

Ends a function and returns zero or more values.

Go

break

Exits the innermost loop or switch, or a labeled statement.

Go

continue

Skips to the next iteration of the innermost loop.

Go

fallthrough

Continues execution into the next case in a Go expression switch.

Go

panic

Stops normal flow and begins panic unwinding.

Go

recover

Regains control from a panic inside a deferred function.

Rust

fn

Declares a function.

Rust

let

Binds a name to a value; bindings are immutable unless declared mut.

Rust

mut

Makes a binding or reference mutable.

Rust

struct

Defines a custom data type with named fields.

Rust

enum

Defines a type with a set of possible variants.

Rust

impl

Defines methods or trait implementations for a type.

Rust

trait

Defines shared behavior that types can implement.

Rust

pub

Makes an item visible outside its current module, subject to visibility rules.

Rust

use

Brings a path into scope or declares a re-export.

Rust

mod

Declares a module, organizing code and controlling visibility.

Rust

match

Selects behavior by exhaustively matching a value's pattern.

Rust

if

Runs a block when a Boolean condition is true; it can also produce a value.

Rust

loop

Repeats a block indefinitely until it exits with break.

Rust

while

Repeats a block while a condition remains true.

Rust

for

Iterates over values from an iterator.

Rust

move

Moves captured values into a closure or transfers ownership.

Rust

async

Defines an asynchronous block or function that produces a Future.

Rust

await

Waits for a Future to complete inside an async context.

Rust

where

Adds constraints to generic type parameters.

Rust

type

Defines a type alias or associated type.

Rust

const

Declares a compile-time constant.

Rust

static

Declares a value with a fixed memory location and static lifetime.

Rust

unsafe

Marks code that may perform operations the compiler cannot fully verify.

Rust

return

Returns a value from a function, though Rust often uses a final expression instead.

Rust

loop

Creates an unconditional loop; its break can return a value.

SQL

SELECT

Chooses columns or expressions to return from a query.

SQL

FROM

Specifies the table or data source to read.

SQL

WHERE

Filters rows before grouping or aggregation.

SQL

JOIN

Combines rows from tables using a related condition.

SQL

LEFT JOIN

Returns all rows from the left table and matching rows from the right.

SQL

GROUP BY

Groups rows so aggregate functions can calculate one result per group.

SQL

HAVING

Filters grouped results, usually after aggregation.

SQL

ORDER BY

Sorts the result set by one or more expressions.

SQL

INSERT

Adds new rows to a table.

SQL

UPDATE

Changes values in existing rows.

SQL

DELETE

Removes rows from a table.

SQL

CREATE

Creates a database object such as a table, view, or index.

SQL

ALTER

Changes the structure of an existing database object.

SQL

DROP

Removes a database object.

SQL

PRIMARY KEY

Constrains a column or set of columns to uniquely identify each row.

SQL

FOREIGN KEY

Constrains values to reference a key in another or the same table.

SQL

UNIQUE

Prevents duplicate values in a column or column combination.

SQL

NOT NULL

Requires a column to have a value rather than NULL.

SQL

NULL

Represents missing or unknown data; comparisons use IS NULL, not = NULL.

SQL

DISTINCT

Removes duplicate rows from the selected result.

SQL

UNION

Combines query results and removes duplicates; UNION ALL keeps them.

SQL

WITH

Defines a common table expression (CTE) for use by a query.

SQL

CASE

Evaluates conditions and returns a value for the first matching branch.

SQL

COMMIT

Makes the current transaction's changes permanent.

SQL

ROLLBACK

Cancels changes made in the current transaction.

SQL

BEGIN

Starts a transaction in many SQL database systems.

SQL

INDEX

A database structure that can speed up lookups at the cost of storage and writes.