 can be used to replace many cases that were previously handled
using C-style <code>for</code> loops.</p>

<p>Example:</p>

<pre><code class="language-swift">// Walk the elements of a tree from a node up to the root
for node in sequence(first: leaf, next: { $0.parent }) {
  // node is leaf, then leaf.parent, then leaf.parent.parent, etc.
}

// Iterate over all powers of two (ignoring overflow)
for value in sequence(first: 1, next: { $0 * 2 }) {
  // value is 1, then 2, then 4, then 8, etc.
}</code></pre>

<