🔟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 -:

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, ", ")

Last updated