 index advanced four positions from an
array's starting index and then prints the element at that position. The
operation doesn't require going beyond the limiting <code>numbers.endIndex</code>
value, so it succeeds.</p>
<pre><code class="language-swift">let numbers = [10, 20, 30, 40, 50]
let i = numbers.index(numbers.startIndex, offsetBy: 4)
print(numbers[i])
// Prints &quot;50&quot;
</code></pre>
<p>The next example attempts to retrieve an index ten positions from
<code>numbers.startIndex</code>, but fail