Codectionary

Developer documentation

Browse Codectionary documentation and code examples for HTML, CSS, JavaScript, TypeScript, Python, Java, C#, Ruby, C++, PHP, and Lua.

HTML documentation

HTML
HTML (HyperText Markup Language) is the standard markup language for creating web pages. It structures web content using elements and tags, defining eve...
HTML Forms
HTML forms are used to collect user input and send it to a server for processing. They contain interactive controls like text fields, checkboxes, radio...
<div>
The <div> element is a generic container used to group and organize content on a web page. It has no semantic meaning on its own but is essential for la...
<span>
The <span> element is an inline container used to group and style specific portions of text or inline elements. Unlike <div>, which is block-level, <spa...
<a>
The <a> (anchor) element creates hyperlinks that allow users to navigate between pages, sections, or external resources. Links are fundamental to the we...
<img>
The <img> element embeds images into web pages. Images enhance visual communication and user engagement. The src attribute specifies the image source, w...
<h1> - <h6>
The heading elements <h1> through <h6> represent six levels of section headings, with <h1> being the most important and <h6> the least. Headings create...
<p>
The <p> element represents a paragraph of text — one of the most fundamental building blocks of written content on the web. Browsers automatically add m...
<ul>
The <ul> element represents an unordered list of items, typically displayed with bullet points. The order of items has no semantic meaning — use <ol> in...
<ol>
The <ol> element represents an ordered (numbered) list, where the sequence of items is meaningful. Like <ul>, every item must be wrapped in an <li> elem...
<table>
The <table> element displays tabular data in rows and columns. A well-structured table uses <thead> for column headers, <tbody> for the main data, <tr>...
<button>
The <button> element creates a clickable button that can trigger actions like submitting a form, resetting a form, or running custom JavaScript. Unlike...
<input>
The <input> element creates interactive form controls for collecting user data. Its behavior changes dramatically based on the type attribute — a single...
<label>
The <label> element defines a caption for a form control, improving both usability and accessibility. Clicking a label activates or focuses its associat...
<textarea>
The <textarea> element creates a multi-line plain-text input control, ideal for comments, messages, and any content longer than a single line. Unlike <i...
<select>
The <select> element creates a dropdown list of options, letting users pick one or more predefined values. Each choice is defined with an <option> eleme...
<header>
The <header> element represents introductory content for its nearest ancestor sectioning element, typically containing a logo, site title, navigation, o...
<nav>
The <nav> element marks a section of major navigation links, such as a main menu, table of contents, or pagination controls. Not every group of links ne...
<footer>
The <footer> element represents closing content for its nearest ancestor sectioning element, typically containing copyright notices, contact information...
<section>
The <section> element groups related content that typically has its own heading, representing a distinct thematic section of a document — like a chapter...
Text Formatting: <strong>, <em>, <b>, <i>, <mark>, <small>
HTML provides several inline elements for formatting text with semantic and visual meaning. <strong> indicates strong importance (typically rendered bol...
<br>, <hr>
These are two simple void (self-closing) elements for controlling text flow. <br> inserts a single line break within text, forcing the next content onto...
<blockquote>, <q>
HTML provides two elements for quoting content from another source. <blockquote> is used for longer, block-level quotations that are typically set apart...
<code>, <pre>, <kbd>
These elements are especially relevant for a developer-focused site like this one. <code> marks up a short inline fragment of computer code, typically r...
<article>
The <article> element represents a self-contained piece of content that could theoretically be distributed or reused independently — like a blog post, n...
<main>
The <main> element represents the dominant, unique content of the document — the content that is directly related to the page's central topic, excluding...
<aside>
The <aside> element represents content that is tangentially related to the surrounding content, such as a sidebar, pull quote, advertisement, or a group...
<figure>, <figcaption>
The <figure> element wraps self-contained content — typically an image, illustration, diagram, code snippet, or chart — along with an optional caption p...
<video>
The <video> element embeds video content directly in a web page without needing a third-party plugin. It supports built-in playback controls, multiple s...
<audio>
The <audio> element embeds sound content — music, podcasts, or sound effects — directly in a page. Like <video>, it supports multiple <source> elements...
<iframe>
The <iframe> element embeds another HTML document within the current page, creating a nested browsing context. It is commonly used for embedding maps, v...
<meta>
The <meta> element provides metadata about the HTML document that is not displayed on the page itself — used for things like character encoding, viewpor...
<link>
The <link> element establishes a relationship between the current document and an external resource, most commonly a stylesheet. It lives in the <head>...
<script>
The <script> element embeds or references executable JavaScript code within an HTML document. It can contain inline code directly between its tags, or l...
<details>, <summary>
The <details> element creates a native, collapsible disclosure widget — content that can be toggled open or closed by the user without any JavaScript. T...
<dialog>
The <dialog> element represents a native modal or non-modal dialog box, such as a confirmation prompt, settings panel, or alert. It comes with built-in...
<time>
The <time> element represents a specific date, time, or duration in a machine-readable format via its datetime attribute, while displaying a human-frien...
<address>
The <address> element provides contact information for its nearest <article> or <body> ancestor. This might be a person, organization, or the author of...
<abbr>
The <abbr> element marks up an abbreviation or acronym, with the title attribute providing the full expansion. Browsers typically show the expansion as...
<fieldset>, <legend>
The <fieldset> element groups related form controls together, typically rendered with a visible border. The <legend> element provides a caption for the...
<progress>, <meter>
These two elements display quantities visually without needing custom-built progress bars. <progress> represents the completion progress of a task, like...
<base>
The <base> element specifies a base URL and/or target for all relative URLs in a document. It must appear inside <head>, and a document should have no m...
<dl>, <dt>, <dd>
The description list group represents a list of term/description pairs — like a glossary or metadata list. <dl> wraps the whole list, <dt> defines each...
<cite>
The <cite> element references the title of a creative work — a book, article, song, movie, or research paper — not the author's name. Browsers typically...
<ins> and <del>
The <ins> element marks text that has been inserted into a document, typically rendered underlined. The <del> element marks text that has been deleted,...
<picture> and <source>
The <picture> element lets the browser choose the most appropriate image from multiple <source> options based on screen size, resolution, or format supp...
<canvas>
The <canvas> element provides a blank, resizable bitmap surface for drawing graphics, animations, and visualizations via JavaScript — typically using th...
<embed> and <object>
The <embed> and <object> elements embed external content — like PDFs, other HTML pages, or browser plugins — into a document. <object> is the more capab...
<map> and <area>
Image maps let different regions of a single image act as separate clickable links. The <map> element defines the map, referenced from an <img> via its...
<noscript>
The <noscript> element defines content to display only when JavaScript is disabled or unsupported in the browser. It commonly contains a message explain...
<output>
The <output> element represents the result of a calculation performed by a script, often used within a form to show a live computed value — like the res...
<datalist>
The <datalist> element provides a list of predefined autocomplete suggestions for an <input> element, without restricting the user to only those choices...
<sub> and <sup>
The <sub> element renders text as subscript (lowered and smaller), and <sup> renders text as superscript (raised and smaller). They are used for their a...
<samp> and <var>
The <samp> element represents sample output from a computer program, typically rendered in monospace. The <var> element represents a variable in a mathe...
<track>
The <track> element specifies timed text tracks for <video> or <audio> elements — most commonly subtitles or captions in WebVTT format. Multiple tracks...
<style>
The <style> element contains embedded CSS rules that apply directly to the current document, as an alternative to linking an external stylesheet with <l...
<title>
The <title> element defines the title of the document, shown in the browser tab, bookmarks, and search engine results. Every HTML document should have e...
<menu>
The <menu> element is a semantic alternative to <ul>, intended specifically for lists of commands or interactive items — like a toolbar or context menu...
<search>
The <search> element is a relatively new HTML5 semantic element that identifies a section of the page containing search or filtering controls — either f...
<svg>
The <svg> element embeds Scalable Vector Graphics directly in HTML — vector-based images built from shapes, paths, and text rather than pixels, so they...
<s> and <u>
The <s> element represents text that is no longer accurate or relevant — like an outdated price or a crossed-out item — rendered with strikethrough. The...
<body>
The <body> element contains all the visible content of an HTML document — text, images, links, forms, and everything a user actually sees and interacts...
<head>
The <head> element contains metadata about the document — information that is not displayed directly on the page but is used by browsers, search engines...
<bdi> and <bdo>
These elements handle bidirectional text — content that mixes left-to-right languages (like English) with right-to-left languages (like Arabic or Hebrew...
<col> and <colgroup>
The <colgroup> element groups one or more columns in a table for the purpose of applying styles, and <col> represents a single column within that group....
<dfn>
The <dfn> element marks the defining instance of a term — the specific place in the text where a term is first introduced and explained. Browsers typica...
<hgroup>
The <hgroup> element groups a heading with one or more subheadings or taglines, treating them as a single unit in the document outline. It is commonly u...
<li>
The <li> element represents an individual item within a list — <ul>, <ol>, or <menu>. Its rendering depends on its parent: inside <ol>, browsers add seq...
<optgroup> and <option>
The <option> element defines a single choice within a <select> dropdown or a <datalist>. The <optgroup> element groups related options together under a...
<ruby>, <rt>, <rp>
Ruby annotations display small pronunciation or translation text above (or next to) East Asian characters, commonly used for showing furigana over Japan...
<wbr>
The <wbr> (word break opportunity) element tells the browser where it is allowed to insert a line break if needed, without forcing one. It is useful for...
<data>
The <data> element links a piece of content with a machine-readable value via its value attribute, similar in spirit to <time> but for values other than...
<template>
The <template> element holds HTML content that the browser parses but does not render or execute when the page loads. Its content is inert — scripts ins...
HTML template Element
The template element holds inert document fragments. Its contents are not rendered until JavaScript clones and inserts them into the document.

Python documentation

True
In Python, True is a built-in constant that represents the boolean value of true. Alongside False, True enables logical and conditional operations. It's...
False
False is Python's built-in constant representing the boolean value false. It's the logical opposite of True and is essential for conditional logic, loop...
if
The if statement is Python's primary conditional control structure. It allows your program to make decisions by executing different code blocks based on...
for
The for loop in Python is used to iterate over sequences like lists, tuples, strings, or any iterable object. Unlike traditional for loops in other lang...
def
The def keyword in Python is used to define functions - reusable blocks of code that perform specific tasks. Functions are fundamental to organizing cod...
class
The class keyword defines a blueprint for creating objects in Python. Classes are the foundation of Object-Oriented Programming (OOP), allowing you to b...
None
None is Python's built-in singleton value that represents the absence of a value or a null result. It is its own type (NoneType) and is commonly used as...
Variables & Assignment
Variables in Python are names bound to values, created the moment you first assign to them - there's no need to declare a type in advance, since Python...
print()
print() is Python's built-in function for writing output to the console. It can accept any number of values, automatically converts them to strings, and...
input()
input() reads a line of text typed by the user from the console and returns it as a string. It optionally accepts a prompt string to display before wait...
Comments & Docstrings
Comments let you annotate code with explanations that Python ignores at runtime. A single-line comment starts with #. Triple-quoted strings (''' or \"\"...
Arithmetic Operators
Python supports the standard arithmetic operators for numeric calculations: addition, subtraction, multiplication, and division, alongside two operators...
Comparison & Logical Operators
Comparison operators (==, !=, <, >, <=, >=) compare two values and always produce a boolean result. Logical operators (and, or, not) combine or invert b...
Type Conversion
Python provides built-in functions to explicitly convert values between types - a process often called type casting. int(), float(), str(), and bool() a...
f-Strings
f-strings (formatted string literals) are Python's modern, preferred way to embed expressions inside string literals. Prefixing a string with f lets you...
String Methods
Strings in Python come with a rich set of built-in methods for transforming, searching, and inspecting text. Common ones include .upper()/.lower() for c...
Lists
A list is Python's built-in ordered, mutable collection type, created with square brackets. Lists can hold items of any type - even a mix of types - and...
Tuples
A tuple is an ordered, immutable collection, created with parentheses (or often just commas). Once created, a tuple's contents cannot be changed, added...
Dictionaries
A dictionary stores data as key-value pairs, created with curly braces. Keys must be unique and hashable (strings, numbers, or tuples are common choices...
Sets
A set is an unordered collection of unique, hashable items, created with curly braces or the set() function. Sets automatically eliminate duplicates and...
List Comprehensions
A list comprehension is a concise, expressive way to build a new list by applying an expression to every item in an iterable, optionally filtering with...
Dictionary & Set Comprehensions
Like list comprehensions, dictionary and set comprehensions provide a concise syntax for building dictionaries and sets from an iterable in a single exp...
Slicing
Slicing extracts a sub-portion of a sequence (list, tuple, or string) using the [start:stop:step] syntax. The slice includes the start index but exclude...
len()
len() is a built-in function that returns the number of items in a collection - the character count of a string, the number of elements in a list or tup...
Nested Data Structures
Python's collections can contain other collections, letting you model real-world structured data like JSON responses, database records, or configuration...
Unpacking & Multiple Assignment
Unpacking lets you assign the elements of a list, tuple, or other iterable to multiple variables in a single statement. The star operator (*) can captur...
while
The while loop repeats a block of code as long as its condition remains True. Unlike a for loop, which iterates a known number of times over a sequence,...
break and continue
break and continue give you fine-grained control over loop execution. break immediately exits the nearest enclosing loop entirely, skipping any remainin...
pass
pass is a null operation - a statement that does absolutely nothing when executed. It exists purely to satisfy Python's syntax, which requires every blo...
range()
range() generates a sequence of numbers, most commonly used to control how many times a for loop runs. It's memory-efficient because it produces numbers...
Conditional (Ternary) Expression
Python's conditional expression - often called a ternary operator - lets you choose between two values based on a condition, all in a single expression...
match / case
Introduced in Python 3.10, the match statement provides structural pattern matching - Python's answer to the switch/case statements found in many other...
try / except
The try/except block lets your program handle errors gracefully instead of crashing. Code that might raise an exception goes in the try block; if an exc...
lambda
A lambda is a small, anonymous, single-expression function, created without the def keyword or a name. Lambdas are restricted to a single expression who...
return
The return statement exits a function immediately and optionally sends a value back to the caller. A function can return any type - including multiple v...
*args and **kwargs
*args and **kwargs let a function accept a variable number of arguments. *args collects any extra positional arguments into a tuple, while **kwargs coll...
Decorators
A decorator is a function that wraps another function to extend or modify its behavior, without changing its actual source code. Decorators use the @dec...
Generators (yield)
A generator is a special kind of function that produces a sequence of values lazily, one at a time, using the yield keyword instead of return. Each call...
map() and filter()
map() and filter() are built-in functions for applying a function across an iterable in a functional programming style. map() transforms every item by a...
Recursion
Recursion is when a function calls itself to solve a smaller instance of the same problem. Every recursive function needs a base case - a condition that...
Closures
A closure is a function that remembers and has access to variables from its enclosing scope, even after that outer function has finished executing. This...
Inheritance & super()
Inheritance lets a class (the child or subclass) reuse and extend the attributes and methods of another class (the parent or superclass), written as cla...
Magic (Dunder) Methods
Magic methods, also called dunder (double underscore) methods, let your custom classes hook into Python's built-in syntax and behavior. __init__ runs on...
@property
The @property decorator lets you define a method that can be accessed like a plain attribute, without parentheses. This is useful for computed values th...
@staticmethod and @classmethod
Regular instance methods automatically receive self, the specific object they were called on. @staticmethod methods receive neither self nor the class -...
Abstract Base Classes
Abstract base classes, provided by the abc module, let you define a common interface that subclasses are required to implement. A class inheriting from...
import
The import statement brings code from another module or package into the current file, letting you reuse functions, classes, and variables defined elsew...
if __name__ == '__main__'
Every Python module has a built-in __name__ variable. When a file is run directly, __name__ is set to '__main__'; when the same file is imported into an...
File Handling
Python's built-in open() function reads from and writes to files on disk. Using it with the 'with' statement (a context manager) ensures the file is aut...
os Module
The os module provides functions for interacting with the operating system - working with file paths, listing directory contents, creating and removing...
datetime Module
The datetime module provides classes for working with dates and times - creating them, formatting them for display, parsing them from text, and performi...
json Module
The json module converts between Python objects and JSON (JavaScript Object Notation) text, the standard format for exchanging data with web APIs and co...
Python Context Managers
A context manager manages setup and cleanup around a block of code. The with statement calls its cleanup logic even when an exception interrupts the block.

CSS documentation

Flexbox
Flexbox (Flexible Box Layout) is a powerful one-dimensional layout system in CSS that makes it easy to design flexible and responsive layouts. It provid...
CSS Grid
CSS Grid is a powerful two-dimensional layout system that provides precise control over both rows and columns simultaneously. Unlike Flexbox which is on...
The Box Model
Every element in CSS is a rectangular box made up of four layers, from innermost to outermost: content, padding, border, and margin. Understanding the b...
box-sizing
box-sizing controls how an element's total width and height are calculated. The default, content-box, means padding and border are added on top of the d...
display Property
The display property determines how an element generates boxes and participates in layout. block elements start on a new line and fill available width....
position Property
The position property controls how an element is positioned in the document. static is the default, following normal flow. relative positions an element...
overflow Property
overflow controls what happens when content is too large to fit its container. visible (default) lets content spill out. hidden clips anything beyond th...
float and clear
float was CSS's original tool for wrapping text around an image or building multi-column layouts, pulling an element to one side while other content flo...
Flex Item Properties
While display: flex controls the container, individual flex items have their own properties for fine-grained control. flex-grow, flex-shrink, and flex-b...
grid-template-areas
grid-template-areas lets you visually lay out a grid using named regions written directly in your CSS, making complex page layouts remarkably readable....
Grid Alignment: place-items, place-content
Grid alignment properties control how content is positioned within grid cells and how the grid itself is positioned within its container. justify-items/...
Container Queries
Container queries let an element style itself based on the size of its containing element, rather than the viewport. This solves a problem media queries...
Font Properties
Core typography properties control how text is displayed. font-family sets the typeface (with fallbacks), font-size controls size, font-weight controls...
Text Properties
Beyond font selection, CSS offers properties to control text alignment, decoration, spacing, and casing. text-align positions text horizontally, text-de...
line-height and Vertical Spacing
line-height controls the vertical space a line of text occupies, directly affecting readability. Unitless values (like 1.5) are generally preferred over...
Color Values
CSS supports several ways to specify color: named colors, hexadecimal, rgb()/rgba(), hsl()/hsla(), and the modern color functions oklch() and color-mix(...
Background Properties
Background properties control an element's background color and image. background-image sets one or more images, background-size controls their scaling,...
Gradients
CSS gradients generate smooth transitions between colors without needing an image file. linear-gradient() transitions along a straight line/angle, radia...
Border Properties
border draws a line around an element's edge, controlled by width, style, and color, which can be set together via the border shorthand or individually...
box-shadow
box-shadow adds one or more drop shadows to an element's box, accepting horizontal offset, vertical offset, blur radius, optional spread radius, and col...
Transitions
Transitions smoothly animate a property change over a specified duration, rather than the change happening instantly. They require a property to transit...
Animations & @keyframes
@keyframes defines a named sequence of styles at different points (0% to 100%) of an animation, which is then applied to an element via the animation pr...
Transforms
transform lets you visually move, rotate, scale, or skew an element without affecting the document flow of surrounding elements - unlike changing positi...
Filters
The filter property applies graphical effects like blur, brightness, contrast, and grayscale directly to an element, similar to Photoshop-style filters....
Length Units: px, %, em, rem
CSS offers several length units. px is an absolute, fixed unit. % is relative to the parent element. em is relative to the current element's font-size (...
Viewport Units: vh, vw, dvh
Viewport units are relative to the browser window's dimensions rather than a parent element. vh and vw represent 1% of the viewport height and width res...
calc(), min(), max(), clamp()
These functions let you compute CSS values dynamically. calc() performs math between different units. min() and max() pick the smallest or largest of a...
Basic Selectors
CSS selectors target elements to style. Type selectors match by tag name, class selectors (.name) match elements with that class, ID selectors (#name) m...
Combinators
Combinators define relationships between selectors. The descendant combinator (space) matches any nested element. The child combinator (>) matches only...
Attribute Selectors
Attribute selectors target elements based on the presence or value of an HTML attribute, using square bracket syntax. They support several matching mode...
:has() - The Parent Selector
:has() matches an element if any of the selectors passed to it match something within it - effectively letting you style a parent based on its children...
:is() and :where()
:is() and :where() both accept a list of selectors and match any of them, letting you write more compact selector groups. The key difference is specific...
Native CSS Nesting
Native CSS nesting lets you write selectors inside other selectors, similar to what Sass offered for years, but now supported directly in browsers with...
Interactive Pseudo-classes
These pseudo-classes style elements based on user interaction state. :hover applies while the pointer is over an element, :focus while it has keyboard f...
:focus-visible and :focus-within
:focus-visible applies only when the browser determines focus should be visibly indicated - typically keyboard navigation, not a mouse click - solving t...
Form State Pseudo-classes
CSS can style form elements based on their validation and interaction state without any JavaScript. :checked applies to checked checkboxes/radios, :disa...
Pseudo-elements
Pseudo-elements let you style a specific part of an element rather than the whole thing, or insert generated content without adding extra HTML. ::before...
Structural Pseudo-classes: nth-child()
Structural pseudo-classes select elements based on their position among siblings, without needing extra classes. :first-child and :last-child match the...
Specificity
When multiple CSS rules target the same element with conflicting declarations, specificity determines which one wins. It is calculated as a four-part va...
Cascade Layers (@layer)
@layer lets you explicitly define the priority order between groups of CSS rules, independent of selector specificity. Styles in a layer declared later...
Custom Properties (CSS Variables)
Custom properties, written as --name, let you define reusable values directly in CSS, accessed with var(). Unlike Sass variables, they are live in the b...
Media Queries
Media queries apply CSS conditionally based on characteristics of the device or viewport, most commonly width, forming the foundation of responsive desi...
prefers-color-scheme & prefers-reduced-motion
These media queries detect user system preferences rather than device characteristics. prefers-color-scheme detects whether the user has requested a lig...
z-index and Stacking Context
z-index controls which element appears on top when elements overlap, but only works on positioned elements (anything other than static). Stacking contex...
Subgrid
subgrid lets a nested grid container inherit the track sizing of its parent grid, instead of defining its own independent tracks. This solves a long-sta...
Sizing: width, min/max-width
Beyond a fixed width, CSS offers min-width and max-width to set flexible boundaries - an element can shrink or grow within those limits. This is fundame...
Logical Properties
Logical properties describe direction in terms of writing mode (inline/block flow) rather than fixed physical directions (left/right/top/bottom). margin...
aspect-ratio
aspect-ratio sets a preferred width-to-height ratio for an element, letting the browser automatically calculate one dimension from the other. This repla...
object-fit and object-position
object-fit controls how a replaced element's content (like an <img> or <video>) is resized to fit its box, similar to background-size but for actual med...
List Styling
list-style controls how list markers (bullets or numbers) appear on <ul>/<ol> elements. list-style-type sets the marker style, list-style-position contr...
scroll-behavior and Scroll Snap
scroll-behavior: smooth animates scrolling to anchors instead of jumping instantly. Scroll snap properties (scroll-snap-type and scroll-snap-align) crea...

JavaScript documentation

Arrow Functions
Arrow functions provide a more concise syntax for writing function expressions in JavaScript. Introduced in ES6, they use the => syntax and have some im...
Async/Await
Async/await is modern JavaScript syntax for handling asynchronous operations, making asynchronous code look and behave like synchronous code. The async...
Variables: var, let, const
JavaScript has three ways to declare variables. var is the original way, function-scoped and hoisted with a default value of undefined. let, introduced...
Data Types
JavaScript has seven primitive data types - string, number, boolean, undefined, null, bigint, and symbol - plus the object type, which includes arrays,...
Arithmetic Operators
Arithmetic operators perform mathematical calculations on numbers: addition (+), subtraction (-), multiplication (*), division (/), remainder/modulo (%)...
Assignment Operators
Assignment operators assign values to variables. Beyond the basic = operator, compound assignment operators combine an operation with assignment in one...
Comparison Operators
Comparison operators compare two values and return a boolean. == and != perform type coercion before comparing (loose equality), while === and !== compa...
Logical Operators
Logical operators combine or invert boolean expressions. && (AND) returns the first falsy value or the last value if all are truthy. || (OR) returns the...
Bitwise Operators
Bitwise operators treat numbers as 32-bit binary sequences and operate on them bit by bit. They include AND (&), OR (|), XOR (^), NOT (~), left shift (<...
Ternary Operator
The ternary (conditional) operator is a compact one-line alternative to an if...else statement. It takes the form condition ? valueIfTrue : valueIfFalse...
Template Literals
Template literals, introduced in ES6, use backticks (`) instead of quotes and allow embedded expressions via ${expression} syntax, along with genuine mu...
Functions: Declarations & Expressions
Functions are reusable blocks of code. A function declaration (using the function keyword with a name) is hoisted, meaning it can be called before its d...
Function Parameters: Default & Rest
Default parameters let you specify a fallback value used when an argument is omitted or undefined. Rest parameters, written with ...name, collect any re...
Destructuring
Destructuring lets you unpack values from arrays or properties from objects into distinct variables in a single concise statement, instead of accessing...
Spread Operator
The spread operator (...) expands an iterable (like an array) or an object's own enumerable properties into individual elements. It is commonly used to...
if...else and switch
if...else executes code blocks based on boolean conditions, with else if for additional conditions and a final else as a catch-all. switch compares a si...
Loops: for, while, do...while
JavaScript offers several loop types. The classic for loop is ideal when you know the number of iterations, using an initializer, condition, and increme...
for...in vs for...of
for...in iterates over the enumerable property keys of an object (or the indices of an array, though this is discouraged). for...of iterates over the va...
break and continue
break immediately exits the nearest enclosing loop (or switch statement), skipping any remaining iterations. continue skips the rest of the current iter...
Objects: Basics
Objects store collections of related data as key-value pairs, where keys are strings (or Symbols) and values can be any type, including functions (calle...
The this Keyword
this refers to the object that is currently executing a function, but its value depends entirely on how the function is called, not where it is defined....
Classes
Classes provide syntax for creating objects with shared structure and behavior, built on top of JavaScript's existing prototype-based inheritance. A cla...
Closures
A closure is a function that remembers and can access variables from its outer (enclosing) scope, even after that outer function has finished executing....
Hoisting
Hoisting is JavaScript's behavior of moving declarations (not initializations) to the top of their scope before code executes. Function declarations are...
Scope
Scope determines where variables are accessible in your code. JavaScript has global scope (accessible everywhere), function scope (var-declared variable...
Strict Mode
"use strict" opts your code into a restricted variant of JavaScript that catches common mistakes by turning them into errors - like accidentally creatin...
Error Handling: try/catch/finally
try...catch lets you handle errors gracefully instead of letting them crash your program. Code that might fail goes in the try block; if an error occurs...
Modules: import/export
ES modules let you split code across multiple files and share functionality between them using export and import. A named export can export multiple val...
Optional Chaining & Nullish Coalescing
Optional chaining (?.) safely accesses deeply nested properties without throwing an error if an intermediate value is null or undefined - it short-circu...
typeof and instanceof
typeof returns a string indicating the general type of a value (like "string", "number", "object"). instanceof checks whether an object is an instance o...
Type Conversion
JavaScript converts values between types both explicitly (when you deliberately call a conversion function like Number() or String()) and implicitly (wh...
Regular Expressions
Regular expressions (RegExp) describe patterns for matching text, used for validation, searching, and replacing. They can be created with literal syntax...
Iterables and Generators
An iterable is any object that implements the Symbol.iterator method, allowing it to be used with for...of and the spread operator - arrays, strings, Ma...
Symbols
Symbol is a primitive type that creates unique, immutable identifiers. Every Symbol() call produces a completely unique value, even with the same descri...
Sets
A Set is a collection of unique values of any type - unlike an array, it automatically prevents duplicates. Sets maintain insertion order and provide ef...
Maps
A Map is a collection of key-value pairs, similar to a plain object, but with important differences: keys can be any type (not just strings), it maintai...
JSON: stringify() and parse()
JSON (JavaScript Object Notation) is a text format for representing structured data, widely used for APIs and configuration. JSON.stringify() converts a...
Array Basics
Arrays are ordered, zero-indexed collections that can hold values of any type, including a mix of types. They can be created with array literal syntax [...
push(), pop(), shift(), unshift()
These four methods add or remove elements from the ends of an array, all mutating the original array in place. push() and pop() work on the end of the a...
slice() and splice()
slice() returns a shallow copy of a portion of an array as a new array, without modifying the original - useful for extracting a section. splice() modif...
concat() and join()
concat() merges two or more arrays into a new array, without modifying the originals. join() converts all array elements into a single string, separated...
indexOf(), includes(), lastIndexOf()
These methods search an array for a specific value. indexOf() returns the first matching index (or -1 if not found), lastIndexOf() searches from the end...
find(), findIndex(), findLast()
These methods search an array using a test function rather than an exact value, making them ideal for finding objects by a property. find() returns the...
filter()
filter() creates a new array containing only the elements that pass a test function, without modifying the original array. It is one of the most commonl...
map()
map() creates a new array by applying a transformation function to every element of the original array, without modifying it. The new array always has t...
reduce() and reduceRight()
reduce() executes a reducer function on each element, accumulating a single result value - useful for sums, grouping, flattening, or building up any kin...
forEach()
forEach() executes a function once for each array element, used purely for side effects like logging or updating external state - it always returns unde...
some() and every()
some() tests whether at least one array element passes a condition, returning true as soon as it finds a match (or false if none do). every() tests whet...
sort() and reverse()
sort() orders the elements of an array in place. Without a comparator function, it converts elements to strings and sorts lexicographically - which prod...
flat() and flatMap()
flat() creates a new array with nested sub-arrays flattened up to a specified depth (default 1 level). flatMap() combines mapping and flattening in a si...
fill() and copyWithin()
fill() changes all elements in an array (or a specified range) to a single static value, mutating the array in place - useful for initializing arrays. c...
String Basics: length, charAt(), at()
Strings are immutable sequences of characters - every string method returns a new string rather than modifying the original. The length property gives t...
slice(), substring(), substr()
These three methods extract a portion of a string as a new string. slice() and substring() are similar, but slice() accepts negative indices (counting f...
indexOf(), includes(), startsWith(), endsWith()
These methods search within a string for a substring. indexOf() returns the position of the first match (or -1). includes() returns a simple true/false....
replace() and replaceAll()
replace() returns a new string with the first match of a pattern replaced by a new value - or all matches, if the pattern is a regex with the global (g)...
split()
split() divides a string into an array of substrings based on a specified separator, which can be a literal string or a regular expression. It is the in...
trim(), trimStart(), trimEnd()
trim() removes whitespace from both ends of a string, commonly used to clean up user input before validation or storage. trimStart() and trimEnd() (alia...
toUpperCase() and toLowerCase()
toUpperCase() and toLowerCase() return a new string with all characters converted to the respective case. They are frequently used for case-insensitive...
padStart(), padEnd(), repeat()
padStart() and padEnd() pad a string with a specified character until it reaches a target length, commonly used for formatting numbers with leading zero...
Number Methods & Parsing
Number methods handle formatting and validation. toFixed() formats a number to a fixed number of decimal places, returning a string. parseInt() and pars...
Math Object: round, floor, ceil, abs, max, min, pow, sqrt
The Math object provides mathematical constants and functions as static methods - it is not a constructor, so you never create a Math instance. Common m...
Math.random()
Math.random() returns a pseudo-random floating-point number between 0 (inclusive) and 1 (exclusive). It is commonly combined with multiplication and Mat...
Date: Creating and Getting Values
The Date object represents a single moment in time. new Date() with no arguments creates the current date/time; it also accepts a specific date, individ...
Date: Setting and Formatting
Setter methods like setFullYear() and setDate() modify a Date object in place. Formatting methods convert a Date into a readable string: toDateString()...
Object.keys(), values(), entries(), assign(), freeze()
These static Object methods work with any plain object. keys(), values(), and entries() return arrays of an object's own enumerable property names, valu...
Promises
A Promise represents a value that may not be available yet - the eventual result of an asynchronous operation. It exists in one of three states: pending...
Promise.all(), allSettled(), race(), any()
These static methods handle multiple promises at once. Promise.all() waits for every promise to resolve, but rejects immediately if any one fails. allSe...
Fetch API
The Fetch API provides a modern, promise-based way to make HTTP requests, replacing the older XMLHttpRequest. fetch() returns a promise that resolves to...
addEventListener() and the Event Object
addEventListener() attaches a function to run when a specific event occurs on an element, without overwriting any other listeners already attached (unli...
Event Bubbling and Delegation
Most events "bubble" - after firing on the target element, they also fire on each ancestor element up to the document root, unless stopped with stopProp...
DOM Selection: querySelector(), getElementById()
These methods find elements in the DOM. getElementById() finds a single element by its unique id, generally the fastest option. querySelector() finds th...
Creating and Modifying Elements
createElement() builds a new DOM element in memory, which can then be customized and inserted into the page with methods like appendChild() or append()....
classList: add, remove, toggle, contains
The classList property provides a convenient API for managing an element's CSS classes without manually parsing the className string. add() and remove()...
localStorage and sessionStorage
localStorage and sessionStorage let you store key-value data directly in the browser, using the same simple API. localStorage persists indefinitely, eve...
Proxy and Reflect
Proxy wraps an object and lets you intercept and customize fundamental operations on it - like getting, setting, or deleting a property - by defining "t...
Typed Arrays & ArrayBuffer
ArrayBuffer represents a fixed-length raw binary data buffer. Typed arrays (Int8Array, Uint8Array, Float32Array, and others) provide a structured, array...
WeakMap and WeakSet
WeakMap and WeakSet are like Map and Set, but their keys (WeakMap) or values (WeakSet) must be objects, and those references are "weak" - meaning they d...
Web Workers
Web Workers run JavaScript on a separate background thread, away from the main UI thread, so expensive computations do not freeze the page. Communicatio...
Temporal API
Temporal is the modern, immutable replacement for the long-criticized Date object, reaching TC39 Stage 4 and becoming part of the ECMAScript 2026 specif...
Getters and Setters
Getters and setters let you define object or class properties that run custom logic when read or assigned, while still being accessed with normal proper...
Custom Error Classes
You can create your own error types by extending the built-in Error class, giving you custom error names and additional properties while still working c...
Object.defineProperty() & Property Descriptors
Object.defineProperty() gives fine-grained control over a single property's behavior via a descriptor object, letting you control whether it is writable...
Intl API: Number & Date Formatting
The Intl object provides language-sensitive formatting for numbers, currencies, dates, and more, correctly following the conventions of a specified loca...
structuredClone()
structuredClone() creates a true deep copy of a value, correctly handling nested objects, arrays, Maps, Sets, dates, and even circular references - some...
URL and URLSearchParams
The URL object parses and constructs URLs, giving structured access to their parts (protocol, host, pathname, etc.) without manual string manipulation....
FormData
FormData represents a set of key-value pairs, mirroring an HTML form's data, and is commonly used to send form submissions (including file uploads) via...
IntersectionObserver
IntersectionObserver efficiently detects when an element enters or exits the viewport (or another container), without the performance cost of manually l...
MutationObserver
MutationObserver watches for changes to the DOM tree - added/removed elements, attribute changes, or text content changes - and runs a callback in respo...
Console Methods Beyond log()
The console object offers several methods beyond the familiar console.log() for more effective debugging: console.table() for tabular data, console.grou...
Tagged Template Literals & String.raw
A tagged template literal calls a function ("tag") with the template's string parts and interpolated values passed separately, letting you fully customi...
Async Generators & for await...of
Async generators combine generators and async functions, defined with async function*, yielding values that may themselves be promises. for await...of c...
getComputedStyle() and element.style
element.style gives direct read/write access to an element's inline styles only - not styles applied via CSS classes or stylesheets. getComputedStyle()...
History API: pushState() and popState
The History API lets JavaScript manipulate the browser's session history and URL without triggering a full page reload - the foundation of client-side r...
Clipboard API
The Clipboard API provides a modern, promise-based way to read from and write to the system clipboard, replacing the older, more limited document.execCo...
JavaScript Optional Chaining & Nullish Coalescing
Optional chaining (?.) stops and produces undefined when its left side is null or undefined. Nullish coalescing (??) supplies a fallback only for null o...

TypeScript documentation

Interfaces
Interfaces in TypeScript define the structure of objects by specifying property names and their types. They act as contracts that ensure objects conform...
Basic Types
TypeScript extends JavaScript with static types, letting the compiler catch type errors before code ever runs. Beyond the familiar string, number, and b...
Type Aliases
The type keyword creates a named alias for any type - not just object shapes like interface, but also unions, primitives, tuples, and function signature...
Union and Intersection Types
A union type (A | B) means a value can be either type A or type B. An intersection type (A & B) means a value must satisfy both A and B simultaneously,...
Literal Types
Literal types narrow a type down to one specific, exact value rather than a general category - "success" instead of string, or 200 instead of number. Th...
Type Inference
TypeScript can automatically determine a value's type from its initializer, without an explicit annotation - this is type inference. It reduces boilerpl...
Type Assertions: as and satisfies
The as keyword tells the compiler to treat a value as a specific type, overriding its own inference - useful when you know more about a value's type tha...
Enums
An enum defines a named set of related constants, making code more readable than using raw numbers or strings for a fixed set of options. Numeric enums...
Typing Functions
Function parameters and return types can be explicitly typed for safety and clarity. Optional parameters (marked with ?) must come after required ones,...
Typed Arrays and Tuples
Arrays are typed as Type[] (or Array<Type>), where every element must be the same type. Tuples, written with square brackets containing specific types,...
type vs interface
Both type and interface can describe object shapes, and for that common case they are largely interchangeable. The key differences: interface supports d...
Index Signatures
An index signature lets an interface or type describe an object with dynamic keys of a known type, when you don't know the exact property names in advan...
Typed Classes
TypeScript enhances JavaScript classes with typed properties, constructor parameters, and method signatures. Class fields must either be initialized or...
Access Modifiers: public, private, protected
Access modifiers control visibility of class members. public (the default) is accessible from anywhere. private restricts access to within the declaring...
Abstract Classes
An abstract class cannot be instantiated directly - it exists only to be extended. It can define abstract methods (a signature with no implementation, w...
implements Keyword
The implements keyword declares that a class must conform to a specific interface's shape - TypeScript checks that every property and method the interfa...
Decorators
Decorators are functions that can observe, modify, or replace a class, method, property, or accessor, applied with @decoratorName syntax. They became a...
Generics Basics
Generics let you write reusable functions, classes, and types that work with a variety of types while still preserving type safety - rather than using a...
Generic Constraints
By default, a generic type parameter can be anything. The extends keyword constrains it to only types compatible with a given shape, letting you safely...
Generic Classes and Interfaces
Classes and interfaces can also be generic, letting you build reusable data structures (like a Stack, Queue, or API response wrapper) that work with any...
Conditional Types
A conditional type selects between two types based on a condition, using syntax that mirrors JavaScript's ternary operator: T extends U ? X : Y. This le...
The infer Keyword
infer, used only within the extends clause of a conditional type, lets you declare a new type variable that captures part of a matched structure, so it...
Mapped Types
A mapped type builds a new type by transforming every property of an existing type, using syntax similar to a for...in loop at the type level: { [K in k...
Partial<T> and Required<T>
Partial<T> constructs a new type with every property of T marked optional - useful for representing partial updates, like a PATCH request body. Required...
Pick<T> and Omit<T>
Pick<T, Keys> constructs a new type by selecting only the specified properties from T. Omit<T, Keys> does the reverse, constructing a new type with all...
Record<K, V>
Record<Keys, ValueType> constructs an object type with a specific set of keys, all mapped to the same value type. It is the concise, standard way to typ...
Readonly<T>
Readonly<T> constructs a new type where every property of T is marked readonly, preventing reassignment after the object is created. It is a shallow tra...
ReturnType<T> and Parameters<T>
ReturnType<T> extracts the return type of a function type, and Parameters<T> extracts its parameter types as a tuple. Both are especially useful for der...
Exclude<T> and Extract<T>
Exclude<UnionType, ExcludedMembers> constructs a type by removing specific members from a union. Extract<UnionType, Union> does the opposite, keeping on...
tsconfig.json Basics
tsconfig.json configures how the TypeScript compiler behaves for a project - which files to include, what JavaScript version to target, and which type-c...
Strict Mode Options
The "strict" tsconfig option is actually a shorthand that enables a whole family of individual strictness flags at once, including strictNullChecks (nul...
Declaration Files (.d.ts)
Declaration files contain only type information, no actual implementation - they describe the shape of existing JavaScript code so TypeScript can type-c...
TypeScript satisfies Operator
The satisfies operator checks that an expression is compatible with a type without replacing the expression’s more specific inferred type.

Java documentation

Classes
Classes in Java are blueprints for creating objects, defining their properties (fields) and behaviors (methods). Java is a strictly object-oriented lang...
Variables & Primitive Data Types
Java is a statically-typed language, meaning every variable must be declared with an explicit type before use, and that type cannot change afterward. Ja...
System.out.println / print / printf
System.out is Java's standard output stream, and it exposes three main methods for writing text to the console. println() prints its argument followed b...
Comments & Javadoc
Java supports single-line comments with //, multi-line comments with /* */, and a special documentation format called Javadoc, written as /** */. Javado...
Arithmetic & Assignment Operators
Java provides the standard arithmetic operators for numeric computation: +, -, *, / for division, and % for the remainder (modulus). It also has compoun...
Comparison & Logical Operators
Comparison operators (==, !=, <, >, <=, >=) compare two values and evaluate to a boolean. Logical operators (&&, ||, !) combine or invert boolean expres...
Strings & String Methods
String is one of the most heavily used classes in Java, representing an immutable sequence of characters - once created, a String's content can never ch...
Type Casting
Type casting converts a value from one data type to another. Widening (implicit) casting happens automatically when converting a smaller type to a large...
Arrays
An array in Java is a fixed-size, ordered collection of elements of the same type, stored in contiguous memory for efficient access. Once created, an ar...
if / else if / else
The if statement executes a block of code only when its condition evaluates to true. Java lets you chain additional conditions with else if, and provide...
switch Statement
The switch statement compares a single value against multiple possible cases, offering a cleaner alternative to a long else if chain when checking one v...
for Loop
The for loop repeats a block of code a specific number of times, controlled by three parts in its header: an initialization (run once), a condition (che...
while and do-while Loops
A while loop repeats its block as long as its condition remains true, checking the condition before each iteration - so the body might never execute at...
break and continue
break and continue give fine-grained control over loop execution in Java. break immediately exits the nearest enclosing loop (or switch statement) entir...
Scanner (User Input)
The Scanner class, from java.util, reads input from various sources - most commonly System.in for keyboard input from the console. It provides typed met...
Methods
A method is a named, reusable block of code that performs a specific task, defined with a return type, a name, and a parameter list. Methods can return...
Wrapper Classes & Autoboxing
Every Java primitive type has a corresponding wrapper class - int has Integer, double has Double, boolean has Boolean, and so on. Wrapper classes turn p...
Interfaces
An interface defines a contract of methods that implementing classes must provide, without specifying how those methods work internally. Unlike a class,...
Abstract Classes
An abstract class is a class that cannot be instantiated directly and may contain both fully implemented methods and abstract methods (declared without...
Constructors
A constructor is a special method that runs automatically when an object is created with 'new', typically used to initialize the object's fields. A cons...
Access Modifiers
Access modifiers control the visibility of classes, fields, and methods from other parts of a program. Java has four levels: public (accessible from any...
Method Overloading
Method overloading lets a class define multiple methods with the same name but different parameter lists - differing in the number, type, or order of pa...
Method Overriding & @Override
Method overriding lets a subclass provide its own specific implementation of a method already defined in its parent class, replacing the inherited behav...
this and super Keywords
The 'this' keyword refers to the current object instance, most often used to distinguish between a field and a constructor/method parameter that share t...
Polymorphism
Polymorphism - literally 'many forms' - lets objects of different subclasses be treated through a common parent type or interface, while each object sti...
Enums
An enum (enumeration) is a special Java type used to define a fixed set of named constants, like the days of the week or possible states of an order. En...
Records
Introduced as a standard feature in Java 16, a record is a compact way to declare an immutable data-carrier class. Writing 'record Point(int x, int y) {...
equals(), hashCode(), and toString()
Every Java class inherits equals(), hashCode(), and toString() from Object, but their default implementations are rarely useful - default equals() check...
Exception Handling
Java uses exceptions to signal that something went wrong during execution. Checked exceptions (like IOException) must be either caught or declared with...
Generics
Generics let you write classes, interfaces, and methods that work with any type while still enforcing type safety at compile time, rather than at runtim...
ArrayList
ArrayList is a resizable array implementation of the List interface, part of java.util. Unlike a plain array, an ArrayList automatically grows as elemen...
LinkedList
LinkedList is a doubly-linked list implementation of both the List and Deque interfaces. Unlike ArrayList, it stores elements as individual nodes linked...
HashMap
HashMap stores data as key-value pairs, offering constant-time (average case) lookup, insertion, and deletion by key, backed by a hash table. Keys must...
HashSet
HashSet is a collection that stores unique elements with no guaranteed ordering, backed by a HashMap internally. Adding a duplicate element has no effec...
TreeMap & TreeSet
TreeMap and TreeSet are sorted collections backed by a red-black tree, automatically keeping their keys (or elements) in ascending order at all times. T...
Iterator
An Iterator provides a standard way to traverse a collection one element at a time without exposing its internal structure, using hasNext() to check for...
Collections Utility Class
java.util.Collections is a utility class full of static helper methods for working with collections - sorting, shuffling, finding the minimum/maximum, r...
Arrays Utility Class
java.util.Arrays is a utility class providing static helper methods specifically for working with arrays - sorting, searching, filling, comparing, copyi...
Queue & Deque
Queue is an interface representing a first-in-first-out (FIFO) collection, typically implemented by LinkedList or the more efficient ArrayDeque. Deque (...
Comparable & Comparator
Comparable and Comparator both define how to order objects, but serve different purposes. A class implements Comparable<T> to define its single 'natural...
Lambda Expressions
A lambda expression is a compact way to represent an anonymous function - a block of code that can be passed around as a value. Lambdas work with functi...
Stream Basics (map, filter, forEach)
The Stream API, introduced in Java 8, provides a functional, declarative way to process sequences of elements from collections, arrays, or other sources...
Stream Terminal Operations
Terminal operations are what actually trigger a stream pipeline to execute and produce a final result, consuming the stream in the process - after a ter...
Collectors
Collectors, used with the stream terminal operation collect(), provide ready-made ways to accumulate stream elements into a final result - a List, Set,...
Optional
Optional<T> is a container object that may or may not hold a non-null value, designed to make the possibility of 'no result' explicit in a method's retu...
Method References
A method reference is shorthand syntax for a lambda that does nothing but call an existing method, using the :: operator. Java supports four kinds: a re...
Creating Threads (Thread & Runnable)
A thread is an independent path of execution within a program, letting multiple tasks run seemingly simultaneously. Java offers two main ways to create...
synchronized Keyword
The synchronized keyword prevents multiple threads from executing a block of code (or a method) at the same time on the same object, protecting shared,...
ExecutorService & Thread Pools
ExecutorService, from java.util.concurrent, manages a pool of reusable threads, letting you submit tasks without manually creating and managing individu...
Atomic Variables
Classes like AtomicInteger, AtomicLong, and AtomicBoolean, from java.util.concurrent.atomic, provide thread-safe operations on single variables without...
Thread Control: sleep, join, interrupt
Java provides several methods for coordinating and controlling thread execution. Thread.sleep() pauses the current thread for a specified duration. join...

C# documentation

Variables & Data Types
C# is a statically-typed language, meaning every variable's type is fixed at compile time. Built-in value types include int, double, decimal, bool, and...
Console.WriteLine / ReadLine
The Console class, from the System namespace, provides the standard way to read from and write to the terminal in a C# console application. Console.Writ...
Comments & XML Documentation
C# supports single-line comments with //, multi-line comments with /* */, and a special triple-slash XML documentation format (///) placed above a membe...
Arithmetic & Assignment Operators
C# provides the standard arithmetic operators for numeric computation: +, -, *, / for division, and % for the remainder. Integer division truncates any...
Comparison & Logical Operators
Comparison operators (==, !=, <, >, <=, >=) compare two values and produce a bool. Logical operators (&&, ||, !) combine or invert boolean expressions,...
Strings & String Interpolation
string represents an immutable sequence of characters in C# - once created, its content never changes, and every 'modifying' operation returns a new str...
String Methods
The string class provides a large set of built-in methods for searching, transforming, splitting, and validating text. Common ones include Split() and J...
Type Conversion & Casting
C# supports implicit conversions (widening, like int to double) that happen automatically since no data is lost, and explicit casts (narrowing, like dou...
Arrays
An array in C# is a fixed-size, ordered collection of elements of the same type, zero-indexed like most C# collections. Once created, an array's length...
if / else if / else
The if statement executes a block of code only when its condition evaluates to true. C# lets you chain additional conditions with else if, and provide a...
switch Statement & Expression
The switch statement compares a single value against multiple possible cases. Traditional C# switch statements require a break after each case. Modern C...
for Loop
The for loop repeats a block of code a specific number of times, controlled by three parts in its header: an initialization (run once), a condition (che...
while and do-while Loops
A while loop repeats its block as long as its condition remains true, checking the condition before each iteration - so the body might never execute at...
break and continue
break and continue give fine-grained control over loop execution. break immediately exits the nearest enclosing loop (or switch statement) entirely, ski...
Classes & Objects
A class is a blueprint for creating objects, bundling related data (fields/properties) and behavior (methods) together. C# is a fully object-oriented la...
Constructors
A constructor is a special method that runs automatically when an object is created with new, used to initialize the object's state. A constructor share...
Properties (get/set)
Properties are C#'s idiomatic way to expose class data through accessor-like syntax while still allowing controlled access via get and set. Unlike a pla...
Access Modifiers
Access modifiers control the visibility of classes, fields, methods, and properties from other parts of a program. C# provides public (accessible from a...
Inheritance & base
Inheritance lets a class (the derived or child class) reuse and extend the members of another class (the base or parent class), written as class Child :...
Polymorphism
Polymorphism lets objects of different derived classes be treated through a common base type or interface, while each object still behaves according to...
Interfaces
An interface defines a contract of members that implementing classes must provide, without specifying how those members work internally. By convention,...
Abstract Classes
An abstract class is a class that cannot be instantiated directly and may contain both fully implemented methods and abstract methods (declared without...
Method Overloading
Method overloading lets a class define multiple methods with the same name but different parameter lists, differing in the number, type, or order of par...
Enums
An enum defines a fixed set of named integer constants, like the days of the week or the possible states of an order. Enums are type-safe - the compiler...
Records
Introduced in C# 9, a record is a reference type designed for immutable data, with built-in value-based equality - two records are considered equal if a...
Exception Handling
C# uses exceptions to signal that something went wrong during execution. A try block wraps risky code, one or more catch blocks handle specific exceptio...
Generics
Generics let you write classes, interfaces, and methods that work with any type while still enforcing type safety at compile time. Instead of writing a...
Structs
A struct is a value type, defined much like a class but with a key difference: structs are copied by value when assigned or passed to a method, while cl...
List<T>
List<T> is a resizable, generic collection from System.Collections.Generic, and the most commonly used collection type in C#. Unlike a plain array, a Li...
Dictionary<TKey, TValue>
Dictionary<TKey, TValue> stores data as key-value pairs, offering fast average-case lookup, insertion, and deletion by key, backed by a hash table. Keys...
Queue<T> & Stack<T>
Queue<T> is a first-in-first-out (FIFO) collection - items are added with Enqueue() and removed with Dequeue(), just like a real-world line. Stack<T> is...
HashSet<T>
HashSet<T> is a collection that stores unique elements with no guaranteed ordering, backed by a hash table. Adding a duplicate element has no effect, si...
foreach & IEnumerable
foreach is C#'s dedicated loop for iterating over any collection that implements IEnumerable<T> - which includes arrays, List<T>, Dictionary<TKey,TValue...
Array Class & Utility Methods
The static Array class, from the System namespace, provides utility methods for working with arrays - sorting, searching, resizing, and copying. Since a...
IComparable & IComparer
IComparable<T> and IComparer<T> both define how to order objects, but serve different purposes. A class implements IComparable<T> to define its single '...
LinkedList<T>
LinkedList<T> is a doubly-linked list implementation from System.Collections.Generic. Unlike List<T>, it stores elements as individual nodes linked to t...
Lambda Expressions
A lambda expression is a compact way to represent an anonymous function - a block of code that can be passed around as a value, using the => (goes to) o...
LINQ Basics: Where & Select
LINQ (Language Integrated Query) provides a consistent, declarative way to query collections, databases, and XML directly within C# syntax. Where() filt...
LINQ Ordering & Grouping
OrderBy() and OrderByDescending() sort a sequence by a key you specify, with ThenBy() for secondary sort keys on ties. GroupBy() splits a sequence into...
LINQ Aggregation: Sum, Count, Average
LINQ provides built-in aggregation methods that reduce a sequence down to a single summary value: Count() for the number of elements, Sum() for a total,...
LINQ Element & Quantifier Operators
Element operators retrieve a single item from a sequence: First()/FirstOrDefault() for the first match, Single()/SingleOrDefault() for exactly one match...
LINQ Deferred Execution
Most LINQ operators (Where, Select, OrderBy, etc.) use deferred execution - they don't actually run when you write the query, only when you enumerate th...
async and await
The async and await keywords let you write asynchronous code that reads almost like ordinary sequential code. Marking a method async allows it to use aw...
Task & Task<T>
Task represents an asynchronous operation that may still be running, and Task<T> represents one that will eventually produce a value of type T. Tasks ar...
Task.WhenAll & Task.WhenAny
Task.WhenAll() lets you run multiple independent asynchronous operations concurrently and await all of them together, completing once every task finishe...
CancellationToken
CancellationToken provides a standard, cooperative way to signal that an asynchronous operation should stop before it completes naturally. A Cancellatio...
Async Pitfalls: void vs Task, ConfigureAwait
A few recurring mistakes trip up many C# developers new to async: using async void instead of async Task (which makes exceptions impossible to catch nor...
Delegates
A delegate is a type-safe reference to a method - essentially a variable that can hold a method and be invoked like one. Delegates enable passing behavi...
Events
An event is a special kind of delegate field that provides a publish-subscribe pattern: the declaring class can raise (invoke) the event, but external c...
Extension Methods
Extension methods let you add new methods to an existing type - including types you don't own, like built-in .NET types or third-party classes - without...
Nullable Reference Types & Null-Coalescing
Since C# 8, nullable reference types let the compiler track and warn about potential null reference issues at compile time, even for reference types lik...
Pattern Matching
Pattern matching, expanded significantly since C# 7, lets you test a value against a shape or condition using is, switch expressions, and more, often ex...
Tuples & Deconstruction
C# tuples let you group multiple values together without defining a dedicated class or struct, ideal for lightweight, temporary groupings like returning...
C# using Declarations
A using declaration disposes an IDisposable resource automatically at the end of the enclosing scope. It is a concise alternative to a nested using stat...

Ruby documentation

Ruby Variables & Strings
Ruby uses local variables without a declaration keyword. Strings can be enclosed in single or double quotes; double-quoted strings support interpolation...
Ruby Arrays & Hashes
Arrays are ordered collections written with square brackets. Hashes store key-value pairs and are commonly written with symbol keys such as :name.
Ruby Methods, Blocks & Enumerable
Methods are declared with def and return their final expression unless return is used explicitly. Many collection methods accept blocks, which makes tra...
Ruby Classes & Modules
Classes define objects and their behaviour. initialize is the conventional constructor method. Modules can group methods and constants, and can be mixed...
Ruby Exceptions
Ruby signals exceptional failures by raising exceptions. rescue handles a matching exception, while ensure runs whether the operation succeeded or failed.
Ruby comments
Ruby reference for ruby comments.
Ruby local variables
Ruby reference for ruby local variables.
Ruby numbers
Ruby reference for ruby numbers.
Ruby symbols
Ruby reference for ruby symbols.
Ruby string quotes
Ruby reference for ruby string quotes.
Ruby string interpolation
Ruby reference for ruby string interpolation.
Ruby string methods
Ruby reference for ruby string methods.
Ruby array indexing
Ruby reference for ruby array indexing.
Ruby array mutation
Ruby reference for ruby array mutation.
Ruby hash literals
Ruby reference for ruby hash literals.
Ruby Hash#fetch
Ruby reference for ruby hash#fetch.
Ruby ranges
Ruby reference for ruby ranges.
Ruby booleans and nil
Ruby reference for ruby booleans and nil.
Ruby comparisons
Ruby reference for ruby comparisons.
Ruby logical operators
Ruby reference for ruby logical operators.
Ruby if and elsif
Ruby reference for ruby if and elsif.
Ruby unless
Ruby reference for ruby unless.
Ruby case and when
Ruby reference for ruby case and when.
Ruby ternary expressions
Ruby reference for ruby ternary expressions.
Ruby while loops
Ruby reference for ruby while loops.
Ruby until loops
Ruby reference for ruby until loops.
Ruby for loops
Ruby reference for ruby for loops.
Ruby each
Ruby reference for ruby each.
Ruby times
Ruby reference for ruby times.
Ruby map
Ruby reference for ruby map.
Ruby select
Ruby reference for ruby select.
Ruby reduce
Ruby reference for ruby reduce.
Ruby method definitions
Ruby reference for ruby method definitions.
Ruby default arguments
Ruby reference for ruby default arguments.
Ruby splat arguments
Ruby reference for ruby splat arguments.
Ruby keyword arguments
Ruby reference for ruby keyword arguments.
Ruby blocks and yield
Ruby reference for ruby blocks and yield.
Ruby Proc objects
Ruby reference for ruby proc objects.
Ruby lambdas
Ruby reference for ruby lambdas.
Ruby instance variables
Ruby reference for ruby instance variables.
Ruby attr_accessor
Ruby reference for ruby attr_accessor.
Ruby class inheritance
Ruby reference for ruby class inheritance.
Ruby super
Ruby reference for ruby super.
Ruby modules
Ruby reference for ruby modules.
Ruby include
Ruby reference for ruby include.
Ruby constants
Ruby reference for ruby constants.
Ruby method visibility
Ruby reference for ruby method visibility.
Ruby singleton methods
Ruby reference for ruby singleton methods.
Ruby require
Ruby reference for ruby require.
Ruby begin and rescue
Ruby reference for ruby begin and rescue.
Ruby ensure
Ruby reference for ruby ensure.
Ruby File.read
Ruby reference for ruby file.read.
Ruby File.write
Ruby reference for ruby file.write.
Ruby regular expressions
Ruby reference for ruby regular expressions.
Ruby safe navigation
Ruby reference for ruby safe navigation.
Ruby Hash#dig
Ruby reference for ruby hash#dig.
Ruby freeze
Ruby reference for ruby freeze.
Ruby Struct
Ruby reference for ruby struct.
Ruby enumerable predicates
Ruby reference for ruby enumerable predicates.
Ruby pattern matching
Ruby reference for ruby pattern matching.

C++ documentation

C++ Variables, Types & References
C++ is statically typed: a variable has a type such as int, double, bool, or std::string. A reference declared with & is an alias for an existing object.
C++ Conditions & Loops
C++ uses if, else if, and else for decisions. Range-based for loops iterate directly over the elements of a container.
C++ Functions & Lambdas
Functions declare a return type, name, and parameters. Lambdas are anonymous callable objects and can capture surrounding values explicitly.
C++ Classes & RAII
Classes group data and functions. Constructors establish valid state. C++ uses RAII: an object owns a resource for its lifetime and releases it in its d...
C++ Vector & Map
std::vector is a resizable sequence container. std::map stores key-value pairs ordered by key. Both are available through standard-library headers.
C++ comments
C++ reference for c++ comments.
C++ include directives
C++ reference for c++ include directives.
C++ auto type deduction
C++ reference for c++ auto type deduction.
C++ const values
C++ reference for c++ const values.
C++ enum class
C++ reference for c++ enum class.
C++ built-in arrays
C++ reference for c++ built-in arrays.
C++ std::array
C++ reference for c++ std::array.
C++ std::string
C++ reference for c++ std::string.
C++ references
C++ reference for c++ references.
C++ pointers
C++ reference for c++ pointers.
C++ nullptr
C++ reference for c++ nullptr.
C++ arithmetic operators
C++ reference for c++ arithmetic operators.
C++ comparison operators
C++ reference for c++ comparison operators.
C++ logical operators
C++ reference for c++ logical operators.
C++ if initializers
C++ reference for c++ if initializers.
C++ switch statements
C++ reference for c++ switch statements.
C++ for loops
C++ reference for c++ for loops.
C++ range-based for loops
C++ reference for c++ range-based for loops.
C++ while loops
C++ reference for c++ while loops.
C++ do-while loops
C++ reference for c++ do-while loops.
C++ function definitions
C++ reference for c++ function definitions.
C++ pass by value
C++ reference for c++ pass by value.
C++ const reference parameters
C++ reference for c++ const reference parameters.
C++ function overloading
C++ reference for c++ function overloading.
C++ default arguments
C++ reference for c++ default arguments.
C++ lambdas
C++ reference for c++ lambdas.
C++ structs
C++ reference for c++ structs.
C++ class access control
C++ reference for c++ class access control.
C++ constructor initializer lists
C++ reference for c++ constructor initializer lists.
C++ destructors
C++ reference for c++ destructors.
C++ inheritance
C++ reference for c++ inheritance.
C++ virtual and override
C++ reference for c++ virtual and override.
C++ pure virtual functions
C++ reference for c++ pure virtual functions.
C++ function templates
C++ reference for c++ function templates.
C++ class templates
C++ reference for c++ class templates.
C++ namespaces
C++ reference for c++ namespaces.
C++ using declarations
C++ reference for c++ using declarations.
C++ exceptions
C++ reference for c++ exceptions.
C++ std::unique_ptr
C++ reference for c++ std::unique_ptr.
C++ std::shared_ptr
C++ reference for c++ std::shared_ptr.
C++ RAII
C++ reference for c++ raii.
C++ std::vector
C++ reference for c++ std::vector.
C++ std::map
C++ reference for c++ std::map.
C++ std::unordered_map
C++ reference for c++ std::unordered_map.
C++ std::set
C++ reference for c++ std::set.
C++ std::sort
C++ reference for c++ std::sort.
C++ std::find_if
C++ reference for c++ std::find_if.
C++ std::transform
C++ reference for c++ std::transform.
C++ iterators
C++ reference for c++ iterators.
C++ file streams
C++ reference for c++ file streams.
C++ std::optional
C++ reference for c++ std::optional.
C++ std::variant
C++ reference for c++ std::variant.
C++ std::tuple
C++ reference for c++ std::tuple.
C++ chrono durations
C++ reference for c++ chrono durations.
C++ scoped enum values
C++ reference for c++ scoped enum values.
C++ move semantics
C++ reference for c++ move semantics.

PHP documentation

PHP Variables & Strings
PHP variables start with $. Double-quoted strings interpolate variables, while single-quoted strings generally treat their contents literally.
PHP Arrays
PHP arrays are ordered maps: they can use integer indexes or string keys. Array literals use square brackets.
PHP Functions & Type Declarations
PHP functions use the function keyword. Parameter and return type declarations can document and enforce the values a function accepts and returns.
PHP Request Data
PHP exposes HTTP request data through superglobal arrays such as $_GET and $_POST. Data from a request is untrusted and should be validated before use.
PHP Classes & Interfaces
Classes define objects, while interfaces define methods an implementing class must provide. Visibility controls whether members are public, protected, o...
PHP opening tags
PHP reference for php opening tags.
PHP comments
PHP reference for php comments.
PHP variables
PHP reference for php variables.
PHP constants
PHP reference for php constants.
PHP string quotes
PHP reference for php string quotes.
PHP heredoc strings
PHP reference for php heredoc strings.
PHP strict types
PHP reference for php strict types.
PHP indexed arrays
PHP reference for php indexed arrays.
PHP associative arrays
PHP reference for php associative arrays.
PHP array destructuring
PHP reference for php array destructuring.
PHP arithmetic operators
PHP reference for php arithmetic operators.
PHP comparison operators
PHP reference for php comparison operators.
PHP logical operators
PHP reference for php logical operators.
PHP null coalescing
PHP reference for php null coalescing.
PHP nullsafe operator
PHP reference for php nullsafe operator.
PHP if and else
PHP reference for php if and else.
PHP switch statements
PHP reference for php switch statements.
PHP match expressions
PHP reference for php match expressions.
PHP ternary expressions
PHP reference for php ternary expressions.
PHP while loops
PHP reference for php while loops.
PHP for loops
PHP reference for php for loops.
PHP foreach loops
PHP reference for php foreach loops.
PHP function definitions
PHP reference for php function definitions.
PHP union types
PHP reference for php union types.
PHP default parameters
PHP reference for php default parameters.
PHP named arguments
PHP reference for php named arguments.
PHP variadic functions
PHP reference for php variadic functions.
PHP closures
PHP reference for php closures.
PHP arrow functions
PHP reference for php arrow functions.
PHP exceptions
PHP reference for php exceptions.
PHP include and require
PHP reference for php include and require.
PHP namespaces
PHP reference for php namespaces.
PHP use imports
PHP reference for php use imports.
PHP member visibility
PHP reference for php member visibility.
PHP constructor promotion
PHP reference for php constructor promotion.
PHP readonly properties
PHP reference for php readonly properties.
PHP interfaces
PHP reference for php interfaces.
PHP traits
PHP reference for php traits.
PHP static members
PHP reference for php static members.
PHP enums
PHP reference for php enums.
PHP __construct
PHP reference for php __construct.
PHP superglobals
PHP reference for php superglobals.
PHP filter_input
PHP reference for php filter_input.
PHP sessions
PHP reference for php sessions.
PHP cookies
PHP reference for php cookies.
PHP JSON encode and decode
PHP reference for php json encode and decode.
PHP password hashing
PHP reference for php password hashing.
PHP PDO connections
PHP reference for php pdo connections.
PHP PDO prepared statements
PHP reference for php pdo prepared statements.
PHP DateTimeImmutable
PHP reference for php datetimeimmutable.
PHP file_get_contents
PHP reference for php file_get_contents.
PHP file_put_contents
PHP reference for php file_put_contents.
PHP generators
PHP reference for php generators.
PHP array_map
PHP reference for php array_map.
PHP array_filter
PHP reference for php array_filter.
PHP throw expressions
PHP reference for php throw expressions.

Lua documentation

Lua Variables & Values
Lua uses local for scoped variables. Its basic value types include nil, boolean, number, string, function, table, thread, and userdata.
Lua Tables
Tables are Lua’s main compound data structure. They can act as arrays, dictionaries, objects, and namespaces; indexes begin at 1 by convention for seque...
Lua Conditions & Loops
Lua uses then/end for conditionals and do/end for loops. In Lua, only false and nil are falsey; zero and empty strings are truthy.
Lua Functions & Closures
Functions are first-class values in Lua: they can be stored, passed, and returned. A nested function can close over a local variable from its surroundin...
Lua Modules
Lua modules typically return a table of public functions and values. require loads a module and returns the value it exported, caching it for later requ...
Lua comments
Lua reference for lua comments.
Lua local variables
Lua reference for lua local variables.
Lua global variables
Lua reference for lua global variables.
Lua nil
Lua reference for lua nil.
Lua booleans
Lua reference for lua booleans.
Lua numbers
Lua reference for lua numbers.
Lua strings
Lua reference for lua strings.
Lua string concatenation
Lua reference for lua string concatenation.
Lua multiline strings
Lua reference for lua multiline strings.
Lua array-style tables
Lua reference for lua array-style tables.
Lua keyed tables
Lua reference for lua keyed tables.
Lua table.insert and remove
Lua reference for lua table.insert and remove.
Lua length operator
Lua reference for lua length operator.
Lua pairs
Lua reference for lua pairs.
Lua ipairs
Lua reference for lua ipairs.
Lua arithmetic operators
Lua reference for lua arithmetic operators.
Lua comparison operators
Lua reference for lua comparison operators.
Lua logical operators
Lua reference for lua logical operators.
Lua if then end
Lua reference for lua if then end.
Lua elseif
Lua reference for lua elseif.
Lua while loops
Lua reference for lua while loops.
Lua repeat until loops
Lua reference for lua repeat until loops.
Lua numeric for loops
Lua reference for lua numeric for loops.
Lua generic for loops
Lua reference for lua generic for loops.
Lua break
Lua reference for lua break.
Lua goto and labels
Lua reference for lua goto and labels.
Lua multiple return values
Lua reference for lua multiple return values.
Lua closures
Lua reference for lua closures.
Lua varargs
Lua reference for lua varargs.
Lua colon methods
Lua reference for lua colon methods.
Lua pcall
Lua reference for lua pcall.
Lua xpcall
Lua reference for lua xpcall.
Lua error and assert
Lua reference for lua error and assert.
Lua require
Lua reference for lua require.
Lua dofile and loadfile
Lua reference for lua dofile and loadfile.
Lua coroutine.create
Lua reference for lua coroutine.create.
Lua coroutine.resume
Lua reference for lua coroutine.resume.
Lua coroutine.yield
Lua reference for lua coroutine.yield.
Lua metatables
Lua reference for lua metatables.
Lua setmetatable
Lua reference for lua setmetatable.
Lua __index metamethod
Lua reference for lua __index metamethod.
Lua __newindex metamethod
Lua reference for lua __newindex metamethod.
Lua operator metamethods
Lua reference for lua operator metamethods.
Lua string library
Lua reference for lua string library.
Lua table library
Lua reference for lua table library.
Lua math library
Lua reference for lua math library.
Lua io library
Lua reference for lua io library.
Lua os library
Lua reference for lua os library.
Lua package paths
Lua reference for lua package paths.
Lua collectgarbage
Lua reference for lua collectgarbage.
Lua weak tables
Lua reference for lua weak tables.
Lua rawget and rawset
Lua reference for lua rawget and rawset.
Lua bitwise operators
Lua reference for lua bitwise operators.
Lua table.concat
Lua reference for lua table.concat.
Lua module tables
Lua reference for lua module tables.