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

Syntax

Tea uses `var` and `const`, block endings with `end`, backtick interpolation, and expression-friendly control flow.

Tea keeps the surface syntax small. Most files are built from a few recurring pieces: bindings, blocks that end with end, control flow, and strings with backtick interpolation.

This page focuses on how code is written, not on the full type system. If you are learning the language, these are the forms you will see first in everyday Tea programs.

Bindings, blocks, and if

Local values use const and var. Control-flow blocks start with a keyword such as if and always close with end.

const is_debug = true
var label = "tea"

if is_debug
  label = "tea (debug)"
else
  label = "tea"
end

const mode = if(is_debug) "verbose" else "normal"

@println(label)
@println(mode)

Loops

Tea supports both while loops for condition-driven repetition and for ... in ... loops for iterating collections.

var count = 0

while count < 3
  @println(count)
  count = count + 1
end

const names = ["tea", "chai"]

for name in names
  @println(name)
end

When iterating dictionaries, you can bind both the key and value directly in the loop header.

const scores = {"tea": 10, "chai": 8}

for name, score in scores
  @println(`${name}: ${score}`)
end

Strings and interpolation

Use double quotes for ordinary strings and backticks when you want interpolation. Expressions inside a backtick string use ${...} placeholders.

var name = "Tea"
var version = 1
@println(`${name} v${version}`)

Core syntax rules

  • Blocks end with end.
  • Use const for stable bindings and var for values you reassign.
  • if(expr) a else b is supported as an expression.
  • while and for ... in ... cover the core looping syntax.
  • Backticks enable string interpolation with ${...} placeholders.

Next steps

Continue to

Types

See list, dict, optional, and function types.

Continue to

Functions

Write named functions and lambdas.