PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Destructuring

Destructuring

Destructuring is a feature.

A shorthand assignment method to extract fields from a composite structure.


Languages with Destructuring include JavaScript, Reason, Coconut

Example from JavaScript:
const o = {p: 42, q: true}; const {p, q} = o;
Example from Reason:
type person = {name: string, age: int}; let somePerson = {name: "Guy", age: 30}; let {name, age} = somePerson;
Example from Coconut:
{"list": [0] + rest} = {"list": [0, 1, 2, 3]}
default-parameters-feature.html 路 destructuring-feature.html 路 file-imports-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 28 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com