> For the complete documentation index, see [llms.txt](https://mavolin.gitbook.io/corgi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mavolin.gitbook.io/corgi/learning-corgi/code.md).

# Code

Corgi allows you to embed code anywhere in your file.

All code you put above the `func` statement is considered *global code* and will be put above the function body. Global code must appear after imports.

Code after the `func` statement will be placed inside the function.

Each code item is denoted by a leading `-`:

{% tabs %}
{% tab title="Corgi" %}

```pug
import "strings"




- var x = 12 // a single line of code

- type RenderNamesData struct {
      Names []string
  }
  // ^ or multiple

func RenderNames(data RenderNamesData)

- namesList := strings.Join(data.Names, ", ")

```

{% endtab %}

{% tab title="Go" %}

```go
import (
    __corgi_io "io"
    "strings"
)

var x = 12 // a single line of code

type RenderNamesData struct {
    Names string
}
// ^ or multiple

func RenderNames(__corgi_w __corgi_io.Writer, data RenderNamesData) error {

    namesList := strings.Join(data.Names, ", ")
}
```

{% endtab %}
{% endtabs %}
