# val ... get() {...} in Kotlin

**URL:** <https://discuss.kotlinlang.org/t/val-get-in-kotlin/6015>\
**Category:** Support\
**Created:** [December 29, 2017, 3:47pm UTC](https://discuss.kotlinlang.org/t/val-get-in-kotlin/6015 "2017-12-29T15:47:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![csmgroup](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@csmgroup](https://discuss.kotlinlang.org/u/csmgroup)\
**Post date:** [December 29, 2017, 3:47pm UTC](https://discuss.kotlinlang.org/t/val-get-in-kotlin/6015/1 "2017-12-29T15:47:51Z")

</div>

From the Kotlin Koan question(  
[kotlin-koans/n16FlatMap.kt at master · Kotlin/kotlin-koans · GitHub](https://github.com/Kotlin/kotlin-koans/blob/master/src/ii_collections/n16FlatMap.kt)), I have this Koan code. How do I read this? It looks like a variable with `val`, but it is a function with a `()` and `{}`.

```
val Customer.orderedProducts: Set<Product> get() {
    // Return all products this customer has ordered
    todoCollectionTask()
}

```

---

<div class="post-metadata">

**Author:** ![alanfo](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@alanfo](https://discuss.kotlinlang.org/u/alanfo)\
**Post date:** [December 29, 2017, 4:23pm UTC](https://discuss.kotlinlang.org/t/val-get-in-kotlin/6015/2 "2017-12-29T16:23:45Z")

</div>

It’s a read-only extension property of the Customer type called orderedProducts.

It returns a `Set<Product> ` and has an explicit getter i.e. a function with signature get() to obtain the value of the property.

It’s sometimes easier to read these if the getter - suitably indented - is placed on the next line.

```auto
val Customer.orderedProducts: Set<Product> 
    get() {
        // Return all products this customer has ordered
        todoCollectionTask()
    }

```
