# letIt

***letIt(it => {** //do something here it **})***

* **The context object** is available as an argument (*it*).
* **The return value** is the lambda result.

*letIt* can be used to invoke one or more functions on results of call chains.

```typescript
const data: Array<number> | null = await idsFromFile();

const str = data?.letIt(it => convertToString(it)) ?? "empty";
```

You can also use withIt to introduce a helper object whose properties or functions are used for calculating a value.

```typescript
const numbers = mutableListOf<string>("one", "two", "three");

const firstAndLast = withIt(numbers, function () {
    return `The first element is ${this.first()}, the last element is ${this.last()}`
});
console.debug(firstAndLast);
```
