PLDB
Languages Features Creators Calendar CSV Resources Blog About Donate Add Language
GitHub icon

Destructuring

< >
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]}
Example from bog:
let add = fn ((a,b)) a + b let tuplify = fn (a,b) (a,b) return add(tuplify(1,2)) # 3

Languages with Destructuring include JavaScript, TypeScript, Reason, Coconut, bog, Static Typescript

Read more about Destructuring on the web: 1.

HTML of this page generated by Features.ts

hasDependentTypes.html 路 hasDestructuring.html 路 hasDirectives.html

View source

PLDB - Build the next great programming language Search v2023 Day 157 Docs Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com