Tea
DocsPlaygroundExamplesReferenceCommunity
GitHub

Tea Language

A strongly typed scripting language for native tools.

© 2026 Tea Language.

ContributingCommunityRepository

Get Started

InstallationGetting StartedCLI

Language

SyntaxTypesFunctionsStructsGenericsPattern MatchingError HandlingModulesTesting

Project

Code StyleContributing

Language

Types

Tea is statically typed with inference for locals and explicit signatures for public function boundaries.

Tea is statically typed, but you do not have to annotate everything by hand. Local bindings are often inferred, while function signatures and other public boundaries stay explicit.

In practice, most programs start with a small set of everyday types: primitives like Int and String, collections such as lists and dictionaries, and optionals for values that may be missing.

Lists and indexing

Lists are written with square brackets and can hold values of a single element type. Index into them with bracket syntax, including nested lists when needed.

const names = ["tea", "chai", "oolong"]
const first = names[0]

const matrix = [[1, 2], [3, 4]]
const bottom_right = matrix[1][1]

@println(first)
@println(bottom_right)

Optionals

Optional types use ?. Reach for them when a value may be absent, then use ?? to provide a fallback or ! only when you know a value is present.

const nickname: String? = nil
const display_name = nickname ?? "tea"

const loaded: String? = "ready"

if loaded != nil
  @println(loaded!)
end

@println(display_name)

Current type surface

  • Primitives: Int, Float, Bool, String.
  • Collections: List[T], Dict[K, V].
  • Optionals: T?, with ?? and !.
  • Functions: Func(...) -> ... for higher-order cases.
  • Struct and error types are declared in Tea source, not in a separate schema language.

Next steps

Continue to

Structs

Define your own typed records.

Continue to

Generics

Parameterize code across types.