title: Why does `local x` inside a zsh for loop output `x=y`?
body: <p>Given</p>
  <pre><code>for v in a b c; do
    local y
    y=$v
  done
  </code></pre>
  <p>Zsh outputs the following automatically:</p>
  <pre><code>y=a
  y=b
  
  </code></pre>
  <p>Why does this occur? What is the use? It wont output <code>y=c</code>, so it's not reliably <code>eval</code>'able but there must be a reason for this behaviour.</p>