🐕
Corgi
  • 🐕About Corgi
  • 🎓Learning Corgi
    • 📂File Structure
    • 🎉Getting Started
    • 🔟Code
    • 📄Arrow Blocks
    • 🪄If and Switch
    • ✏️Interpolation
    • 🔁For
    • 🤝Attributes
    • 🎭Expressions
    • 👮Security and Escaping
    • 💉Nonce Injection
    • ➡️Block Expansions
    • ➕Mixins
    • 📚Libraries
    • ✨The Standard Library
    • 💬Comments
    • ⛓️Filters
    • 🖨️Include
    • 👪Inheritance (Extending)
    • ⚡Breaking Changes
Powered by GitBook
On this page

Was this helpful?

  1. Learning Corgi

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, ", ")
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, ", ")
}
PreviousGetting StartedNextArrow Blocks

Last updated 1 year ago

Was this helpful?

🎓
🔟