# interval

#### signature: `interval(period: number, scheduler: Scheduler): Observable`

## Emit numbers in sequence based on provided timeframe.

### Examples

**Example 1: Emit sequence of values at 1 second interval**

( [StackBlitz](https://stackblitz.com/edit/typescript-ohddud?file=index.ts\&devtoolsheight=100) | [jsBin](http://jsbin.com/vigohomabo/1/edit?js,console) | [jsFiddle](https://jsfiddle.net/btroncone/x3mrwzr0/) )

```js
// RxJS v6+
import { interval } from 'rxjs';

//emit value in sequence every 1 second
const source = interval(1000);
//output: 0,1,2,3,4,5....
const subscribe = source.subscribe(val => console.log(val));
```

### Related Recipes

* [Alphabet Invasion Game](/learn-rxjs/recipes/alphabet-invasion-game.md)
* [Battleship Game](/learn-rxjs/recipes/battleship-game.md)
* [Breakout Game](/learn-rxjs/recipes/breakout-game.md)
* [Car Racing Game](/learn-rxjs/recipes/car-racing-game.md)
* [Catch The Dot Game](/learn-rxjs/recipes/catch-the-dot-game.md)
* [Flappy Bird Game](/learn-rxjs/recipes/flappy-bird-game.md)
* [Matrix Digital Rain](/learn-rxjs/recipes/matrix-digital-rain.md)
* [Memory Game](/learn-rxjs/recipes/memory-game.md)
* [Platform Jumper Game](/learn-rxjs/recipes/platform-jumper-game.md)
* [Space Invaders Game](/learn-rxjs/recipes/space-invaders-game.md)
* [Stop Watch](/learn-rxjs/recipes/stop-watch.md)
* [Tank Battle Game](/learn-rxjs/recipes/tank-battle-game.md)
* [Tetris Game](/learn-rxjs/recipes/tetris-game.md)
* [Uncover Image Game](/learn-rxjs/recipes/uncover-image-game.md)

### Additional Resources

* [interval](https://rxjs.dev/api/index/function/interval) 📰 - Official docs
* [Creation operators: interval and timer](https://egghead.io/lessons/rxjs-creation-operators-interval-and-timer?course=rxjs-beyond-the-basics-creating-observables-from-scratch) 🎥 💵 - André Staltz

***

> 📁 Source Code: <https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/interval.ts>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.learnrxjs.io/learn-rxjs/operators/creation/interval.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
