Array traversal processes one element at a time. A common update pattern starts at index zero, checks the array length, and changes the current element before moving to the next index. The condition uses `< Length` because the last valid index is one less than Length.
int[] scores = { 2, 4, 6 };
for (int i = 0; i < scores.Length; i++)
{
scores[i] = scores[i] + 1;
}The loop visits indexes 0, 1, and 2, changing scores to 3, 5, and 7. Index 3 fails the condition and is never used. Changing the loop to `i <= scores.Length` would attempt an invalid index after the last valid item.
A traversal can read, count, or update elements. This example updates every stored value and leaves the number of elements unchanged. If you only wanted to display values, remove the assignment and print scores[i] instead. Check the first index, the last valid index, and the failed condition at i equal to Length to avoid an extra invalid access.
Trace both the index and array values after each pass. Distinguish updating an existing element from adding a new element; the array length remains three.