Commands
Repeat
Run commands a fixed number of times, with an optional counter, to write sets, days and weeks.
Purpose
The Repeat command can be used whenever you want to repeat a bunch of commands a fixed number of times, for example to instruct the athlete to do multiple sets of an exec.
To issue a repeat command you need an expression that calculates how many times the commands are going to run.
Definition
A repeat command is the keyword repeat, the expression and the commands to
repeat, in curly braces:
action BackSquat [title: "Back squat"]
output:number reps [title: "Reps"]
exec squat() {
specify:BackSquat reps 5
}
repeat 5 { squat() }
The expression can be any calculation that results in a number, e.g.
weeks * 3. A fractional result is rounded down, so repeat 30 / 4 runs 7
times.
Counter
You can optionally define a counter for the repeat: a name, followed by a :,
before the expression. The counter holds the current repetition, starting from
1 and continuing to 2, 3, etc. up to the total:
action BackSquat [title: "Back squat"]
output:number reps [title: "Reps"]
output:|kg| weight [title: "Weight"]
exec squat(load) {
specify:BackSquat reps 5, weight load
}
repeat week:8 {
repeat set:3 {
squat(80|kg| + week * 2.5|kg|)
}
}
The counter is a great way to write progressions. Here every week adds 2.5 kg to the bar.
Execution
A repeat command runs its commands one by one and, when the last one finishes, it runs the same commands again from the start. It does this as many times as the expression says. After the last repetition, the program continues with the command after the repeat.
The commands you can put inside a repeat are dictated by the surrounding context, i.e. whether the repeat is inside an exec, inside a group or at the top level of a file.
Break and continue
Two commands change the course of a repetition:
breakstops the repeat right away; the program continues with the command after it.continueskips the rest of the current repetition and moves on to the next one.
action BackSquat [title: "Back squat"]
output:number reps [title: "Reps"]
input:number reps [title: "Reps"]
exec squat() {
specify:BackSquat reps 5
measure reps
}
repeat 5 {
let set = squat()
if (set.reps < 5) {
break
}
}
This gives the athlete up to five sets of five, and stops at the first set where they could not get all five reps.