Control Flow and Schedule
Culsma supports loops, conditionals, and schedule-driven repetition.
Fixed Repetition
text
repeat 3 {
target << [source:5uL];
}The expression must be decidable for the repeat count.
Schedule Repetition
text
repeat point in schedule(start = 30min, end = 120min, step = 30min) {
let obs = phy(sample = reactor, quantity = temperature);
}Inside the loop, point is bound to the current checkpoint value.
Discrete Schedule Forms
Use start, end, and step:
text
schedule(start = 1, end = 35, step = 1)
schedule(start = 30min, end = 120min, step = 30min)Or use explicit checkpoints:
text
schedule(at = [15min, 45min, 120min])The two forms are alternatives. Do not mix at=[...] with start/end/step in the same schedule.
Continuous Schedule Window
Continuous windows are explicit:
text
schedule(start = 0h, duration = 24h, mode = continuous, observe_every = 1h)Continuous schedules use start + (end | duration). They do not use step or at=[...].
Conditionals
text
if condition {
target << [source:5uL];
} else {
target << [buffer:5uL];
}The condition must be decidable by the compiler/runtime path that owns the values involved.
break and continue
continue; skips the remaining statements in the current loop iteration.
text
repeat 10 {
if skip_condition {
continue;
}
target << [source:1uL];
}break; exits the nearest enclosing repeat.
text
repeat 10 {
if stop_condition {
break;
}
target << [source:1uL];
}break and continue are only valid inside repeat blocks.
