Commands
Ask
Ask the athlete for a single value, right away, and use the answer in the rest of the program.
Purpose
The Ask command is the other way, apart from calling an
exec, in which a program interacts with the athlete. Its purpose
is to literally ask the athlete to provide the value of an
input. An example would be to ask for their age or their
body_weight before the program decides on any loads.
Definition
An ask is an expression: the keyword ask followed by an input. Its value is
the athlete’s answer, so you will usually store it under a name:
input:|kg| body_weight [title: "Body weight"]
let bw = ask body_weight
Later in the program you can use this name to refer to the provided value, for example to work out a starting load:
input:|kg| body_weight [title: "Body weight"]
action BackSquat [title: "Back squat"]
output:number reps [title: "Reps"]
output:|kg| weight [title: "Weight"]
exec squat(load) {
specify:BackSquat reps 5, weight load
}
let bw = ask body_weight
squat(round(bw * 0.6, 2.5|kg|))
Optional answers
Put a ? in front of the input to make the answer optional. The athlete may
then continue without entering anything, and the value is nil:
input:|kg| one_rep_max [title: "Your squat 1RM, if you know it"]
let known_max = ask ?one_rep_max
Since nil counts as false in a condition, checking whether the athlete
answered is easy:
input:|kg| one_rep_max [title: "Your squat 1RM, if you know it"]
action BackSquat [title: "Back squat"]
output:number reps [title: "Reps"]
output:|kg| weight [title: "Weight"]
exec squat(load) {
specify:BackSquat reps 5, weight load
}
let known_max = ask ?one_rep_max
squat(known_max ? round(known_max * 0.75, 2.5|kg|) : 60|kg|)
Execution
When an ask runs, the program halts and the athlete is presented with a single
field to fill in, titled with the input’s title. When they continue, the
answer becomes the value of the ask expression and the program goes on.
Ask or measure?
Both get a value from the athlete, but at different moments:
- measure collects inputs after the athlete has performed an exec or a group, on the same screen as the specification.
askasks right now, on a screen of its own, with nothing to perform.
Use measure for how a set went and ask for facts the program needs before
it can go on.