Glossary coding Term Page

Closure

An anonymous function-like expression that captures surrounding values

closure #rust#functional#borrowing
Korean version

Aliases

anonymous function

Prerequisites

Related Concepts

Core Idea

A closure is a function-like expression that can capture values from the surrounding scope. In Rust the capture mode follows how the body uses those values, which makes closures a practical way to learn references and borrowing at the same time.

Why It Matters Here

Mathbong uses closures in map, filter, event handling, and threads that take captured values. They look like small functions, but the key difference is that they carry surrounding context with them.

Posts Mentioning This Concept