# It is not correct.

<run start>

"hello"
"a"
"b"
"c"

<run complete>
```
</CodeGroup>

Any non-deterministic logic (like database calls or API calls) must be placed inside a `step.run` call to ensure it is executed correctly within each step.

With this in mind, here is how the previous example can be fixed:

```go
import (
    "fmt"
    "github.com/inngest/inngestgo"
    "github.com/inngest/inngestgo/step"
)

inngestgo.CreateFunction(
	client,
	inngestgo.FunctionOpts{ID: "simple-function"},
	inngestgo.EventTrigger("test/simple.function", nil),
	func(ctx context.Context, input inngestgo.Input[map[string]any]) (any, error) {
		if _, err := step.Run(ctx, "hello", func(ctx context.Context) (any, error) {
			fmt.Println("hello")
			return nil, nil
		}); err != nil {
			return nil, err
		}

		if _, err := step.Run(ctx, "a", func(ctx context.Context) (any, error) {
			fmt.Println("a")
			return nil, nil
		}); err != nil {
			return nil, err
		}

		if _, err := step.Run(ctx, "b", func(ctx context.Context) (any, error) {
			fmt.Println("b")
			return nil, nil
		}); err != nil {
			return nil, err
		}

		if _, err := step.Run(ctx, "c", func(ctx context.Context) (any, error) {
			fmt.Println("c")
			return nil, nil
		}); err != nil {
			return nil, err
		}

		return nil, nil
	},
)

// hello
// a 
// b
// c
```

Now, "hello" is printed only once, as expected.

</GuideSection>

<GuideSection show="python">
Let's start with a simple example to illustrate the concept:

```python
@inngest_client.create_function(
    fn_id="simple-function",
    trigger=inngest.TriggerEvent(event="test/simple.function")
)
async def simple_function(ctx: inngest.Context):
    print("hello")

    async def step_a():
        print("a")
    await ctx.step.run("a", step_a)

    async def step_b():
        print("b") 
    await ctx.step.run("b", step_b)

    async def step_c():
        print("c")
    await ctx.step.run("c", step_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" }}