# cycle
[](https://hex.pm/packages/cycle)
[](https://hexdocs.pm/cycle/)
```sh
gleam add cycle@1
```
```gleam
import cycle
pub fn main() -> Nil {
echo cycle.start(with: #([], 0), run: fn(state) {
let #(is, i) = state
case i < 5 {
True -> {
let i = i + 1
cycle.continue(#(list.prepend(is, i), i))
}
_ -> cycle.stop(is)
}
})
// output: [5, 4, 3, 2, 1]
}
```
Further documentation can be found at <https://hexdocs.pm/cycle>.
## Development
```sh
gleam run # Run the cycle
gleam test # Run the tests
```