title: exit for = spaghetti code?
body: <p>I have always been taught to have one exit from functions and write code that doesn't jump all over the place, is the following bad code or is there a better way to write the for loop without needing an "exit for"?</p>
  
  <pre><code>dim dt as datatable = FillDataTableFunction()
  dim bWrite as boolean = false
  for each row as datarow in dt.rows
    if row.item("somecolumn") &lt;&gt; string.empty then 
      bWrite = true
      exit for
    end if 
  next
  
  if bWrite then 
    'do stuff
  end if
  </code></pre>
  
  <p>I guess I am just thinking that this will reduce unneeded iterations through the for loop but for some reason it seems like a bad coding practice. </p>