# spawn

```ts
function spawn<T>(op: () => Operation<T>): Operation<Task<T>>
```

Run another operation concurrently as a child of the current one.

The spawned operation will begin executing at the next available
opportunity.

### Examples
#### Example 1
```js
import { main, sleep, suspend, spawn } from 'effection';

await main(function*() {
  yield* spawn(function*() {
    yield* sleep(1000);
    console.log("hello");
  });
  yield* spawn(function*() {
    yield* sleep(2000);
    console.log("world");
  });
  yield* suspend();
});
```

---
### Type Parameters
T
the type that the spawned task evaluates to


### Parameters


**op**: () => [Operation](https://frontside.com/effection/api/v4/Operation.md)&lt;T&gt;


the operation to run as a child of the current task
### Return Type


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


a [Task](https://frontside.com/effection/api/v4/Task.md) representing a handle to the running operation

[View code](https://github.com/thefrontside/effection/tree/effection-v4.2.0/lib/spawn.ts#L32)
