# Return in lambda expression

**URL:** <https://discuss.kotlinlang.org/t/return-in-lambda-expression/26231>\
**Category:** Support\
**Created:** [January 18, 2023, 9:03am UTC](https://discuss.kotlinlang.org/t/return-in-lambda-expression/26231 "2023-01-18T09:03:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentBerger](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@LaurentBerger](https://discuss.kotlinlang.org/u/LaurentBerger)\
**Post date:** [January 18, 2023, 9:03am UTC](https://discuss.kotlinlang.org/t/return-in-lambda-expression/26231/1 "2023-01-18T09:03:52Z")

</div>

Hi,  
I’m working on lambda expression

I wrote this code :

```auto
val calcul:(Int, Int)->Int={x: Int, y: Int -> val z = x+y
z}

```

exverything is OK  
Now I try to use return as in the [doc](https://kotlinlang.org/docs/lambdas.html#returning-a-value-from-a-lambda-expression)

```auto
val calcul:(Int, Int)->Int={x: Int, y: Int -> val z = x+y
return@calcul z}

```

I have got an error :  
ERROR ‘return’ is not allowed here (Line\_83.kts:2:1)

Why this error?

---

<div class="post-metadata">

**Author:** ![broot](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@broot](https://discuss.kotlinlang.org/u/broot)\
**Post date:** [January 18, 2023, 9:15am UTC](https://discuss.kotlinlang.org/t/return-in-lambda-expression/26231/2 "2023-01-18T09:15:04Z")

</div>

It doesn’t create an implicit label in this case, you have to create it explicitly:

```kotlin
val calcul:(Int, Int)->Int= calcul@ {x: Int, y: Int -> val z = x+y
return@calcul z}

```
