# Lambda within lambda

**URL:** <https://community.openhab.org/t/lambda-within-lambda/22913>\
**Category:** Scripts & Rules\
**Tags:** lambda\
**Created:** [February 13, 2017, 10:25pm UTC](https://community.openhab.org/t/lambda-within-lambda/22913 "2017-02-13T22:25:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [February 13, 2017, 10:53pm UTC](https://community.openhab.org/t/lambda-within-lambda/22913/2 "2017-02-13T22:53:03Z")

</div>

You can refer to lambda X inside lambda Y, but remember that everything external referred to in a lambda (except Items) must be passed into it.  
You’ll need to add another parameter and pass in the name of the lambda function.  
Examples (ignore the Timer stuff, the interest is passing one function to another)

> [@Design Pattern: Recursive Timers](https://community.openhab.org/t/design-pattern-recursive-timers/17114):
>
> Problem Statement Often one finds a situation where at the end of a triggered timer one wants to reschedule the timer to go off again. But if you do this in the normal way that means you need a full copy of the Timer’s body inside the Timer’s body inside the Timer’s body and so on and so on ad infinitum. This DP is deprecated. Please see [Design Pattern: Looping Timers](https://community.openhab.org/t/design-pattern-looping-timers/47699) for the current best way to handle this type of problem.

For your string (IP) you have a choice of either passing it in as another parameter, or put it into a String Item where you can get at it.

---

_[View the full topic](https://community.openhab.org/t/lambda-within-lambda/22913)._
