# each

```ts
function each<T>(stream: Stream<T, unknown>): Operation<Iterable<T>>
```

Consume an effection stream using a simple for-of loop.

Given any stream, you can access its values sequentially using the `each()`
operation just as you would use `for await of` loop with an async iterable:

```javascript
function* logvalues(stream) {
  for (let value of yield* each(stream)) {
    console.log(value);
    yield* each.next()
  }
}
```
You must always invoke `each.next` at the end of each iteration of the loop,
including if the interation ends with a `continue` statement.

Note that just as with async iterators, there is no way to consume the
`TClose` value of a stream using the `for-each` loop.

### Type Parameters
T
the type of each value in the stream.


### Parameters


**stream**: [Stream](https://frontside.com/effection/api/v3/Stream.md)&lt;T, unknown&gt;


the stream to iterate
### Return Type


[Operation](https://frontside.com/effection/api/v3/Operation.md)&lt;Iterable&lt;T&gt;&gt;


an operation to iterate `stream`

[View code](https://github.com/thefrontside/effection/tree/effection-v3.6.1/lib/each.ts#L31)

```ts
namespace each
```

Additional properties on the `each` function.

[View code](https://github.com/thefrontside/effection/tree/effection-v3.6.1/lib/each.ts#L78)
