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.