discard

Advanced 💻 Tech / IT

Definition

In programming, a throwaway variable (often represented as an underscore) that catches a function return value your code explicitly doesn't need, like a digital dumpster for irrelevant data.

Example Usage

The API returned a tuple with seven values, but we used discards for five of them because only the user ID and timestamp mattered to our logic.

Source: Programming language terminology, particularly Go, Rust, and Scala

Related Terms