Core elements
Input
A piece of information the athlete provides, like the reps they managed or their body weight.
An Input is one of the core elements of the Coach language. It represents information that can be provided by the athlete: the reps they actually did, how hard a set felt or their body weight.
Definition
To define an input you need the keyword input, a type, a name and a list of
properties in square brackets (the list may be empty):
input:number reps [title: "Reps"]
input:|kg| body_weight [title: "Body weight"]
input:boolean easy? [title: "Was it easy?"]
input:string comments []
Think of the type as the type of the value that you get back from the athlete when you use this input. It can be one of:
number, e.g.repsorage,- a unit of measurement between vertical bars,
e.g.
|kg|,|min|or|km/h|, for inputs likebody_weightorduration, boolean, e.g.easy?,string, for free text, e.g.comments.
The name has to start with a letter and may contain letters, digits, _ and
?. The Trainerflow convention is to use a lowercase (snake_case) name for
inputs.
Properties
The properties customize how the input is presented to the athlete:
| Property | What it does |
|---|---|
title |
The label of the field the athlete fills in. Without it, the athlete sees the input’s name. |
description |
A longer explanation shown with the field. |
optional |
When true, the athlete may leave the field empty. |
units |
When true, the athlete enters the value in the input’s own unit instead of their preferred one. |
constraint |
Restrictions on the value, e.g. a list of named choices. |
The athlete cannot continue past an empty field, unless the input is marked
optional (or it was asked for with ask ?). An optional
input that was left empty gives the program nil.
Named choices
There is no list type for inputs. To let the athlete choose from a few options,
use a number input with a constraint that names each value. The first name
stands for 0, the second for 1 and so on:
input:number rpe [
title: "RPE",
constraint: [values: ["Easy", "Moderate", "Hard", "Max effort"]]
]
Inheritance
An input can be derived from another one with <. It keeps the type and the
properties of its parent and adds or overrides its own:
input:|s| duration_seconds [title: "Duration"]
input hold_duration < duration_seconds [title: "Hold duration"]