summary refs log tree commit diff
path: root/src/doc/style/features/loops.md
blob: b144825f98183d8a44bd6143d2b72d5a8c9e188d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
% Loops

### Prefer `for` to `while`. [FIXME: needs RFC]

A `for` loop is preferable to a `while` loop, unless the loop counts in a
non-uniform way (making it difficult to express using `for`).

### Guidelines for `loop`. [FIXME]

> **[FIXME]** When is `loop` recommended? Some possibilities:
> * For optimistic retry algorithms
> * For servers
> * To avoid mutating local variables sometimes needed to fit `while`