Yield

Verb · Development

Definitions

  1. A keyword or operation that pauses a function's execution and emits a value to the caller, preserving the function's local state so it can resume where it left off on the next invocation. Used in generators (Python, JavaScript) and coroutines to produce sequences lazily or cooperatively share a thread.

    In plain English: A way for a function to pause, hand back a result, and later pick up exactly where it left off.

    Example: "The generator yields one row at a time, so we can process a 50 GB CSV without loading it all into memory."

Related Terms