A lot of teaching examples of off-by-one errors which educators provide to their students involve for-loops.
For example, we might have the following for-loop:
// Array `A` contains `50` names indexed from `0` to `49`
//
// 0 ... Orquil Bolouri
// 1 ... Manuel Tobellon
// 2 ... Kabatha Dowling
// 3 ... Lornton Krowley
Toni Toson
// `numel(A)` returns the number of elements in array `A`
// `numel(A)` represents the number `50` in this context
for k from 0 to numel(A) {
first_name = get_first_name(A);
print(first_name);
}