In general, you write name: Type.
setting: int
TYML provides several primitive types:
int : 64‑bit signed integeruint : 64‑bit unsigned integerbool : Boolean, true or falsefloat : Floating‑point numberstring : StringThere are two ways to describe structures.
setting:
type Setting
setting: Setting
There are also two ways to format fields inside a struct.
type Setting
type Setting
You can freely mix the two styles:
type Setting
As a rule of thumb, we recommend 4 spaces for indentation, but tabs are also syntactically valid.
// "setting" must be string; any other keys must be int
setting: string
// If you omit "*", arbitrary extra keys are not allowed
*: int
# !tyml example.tyml
= "string"
# Defining "*" allows arbitrary elements to be provided
= 100
Declaring an enum can restrict string values:
enum Mode
// "mode" only accepts "Debug" or "Release"
mode: Mode
You can separate enum items with commas or newlines, just like struct fields:
enum Mode