> For the complete documentation index, see [llms.txt](https://smllang.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smllang.gitbook.io/home/basics/object-destructuring.md).

# Object Destructuring

Grab it from within

Destructuring allows you to access a field of a struct literal, enum expression. This is done using the val keword as follows:

```sml
struct Person(name: String, age: Int)

fun create_greet_message(person: Person): String => {
    val (name, age) = person (* extract the fields *)
    "Hello " + name + " you are " + age + " years old"
}
```
