# Working with Loops in Inngest

In Inngest each step in your function is executed as a separate HTTP request.  This means that for every step in your function, the function is re-entered, starting from the beginning, up to the point where the next step is executed. This [execution model](/docs/learn/how-functions-are-executed) helps in managing retries, timeouts, and ensures robustness in distributed systems.

This page covers how to implement loops in your Inngest functions and avoid common pitfalls.


## Simple function example

<GuideSelector
  options={[
    { key: 

typescript", title: "TypeScript" },
    { key: "go", title: "Go" },
    { key: "python", title: "Python" },
  ]}>

<GuideSection show="typescript">

Let's start with a simple example to illustrate the concept:

```javascript
inngest.createFunction(
  { id: "simple-function" },
  { event: "test/simple.function" },
  async ({ step }) => {
    console.log("hello");

    await step.run("a", async () => { console.log("a") });
    await step.run("b", async () => { console.log("b") });
    await step.run("c", async () => { console.log("c") });
  }
);
```

In the above example, you will see "hello" printed four times, once for the initial function entry and once for each step execution (`a`, `b`, and `c`).

<CodeGroup forceTabs>
```bash {{ title: "✅ How Inngest executes the code" }}

<run start>
"hello"

"hello"
"a"

"hello"
"b"

"hello"
"c"
<run complete>
```
```bash {{ title: "❌ Common incorrect misconception" }}