title: Netlogo nested loops
body: <p>Basically, my question is how nested loops work in netlogo. I've tried nesting two while loops within each other, but the inner one doesn't seem to behave properly (properly being the way they work in other languages). If I use two different loops though, it works as expected. Do loops in netlogo work similar to labels in assembly language, so that it'll jump to the first while label it notices.</p>
  
  <p>The reason I'm asking is because I've been resorting to using different types of loops with each other, or creating a procedure for the inner loop, which is hurting the readability of my code. Here's an example, where I'm reading in a tab delimited file to assign values to patches:</p>
  
  <pre><code>file-open "map2.txt"
  let i max-pycor
  let j min-pxcor
  while [i &gt;= min-pycor] [
   repeat 33 [ask patch j i [
      ifelse file-read = 1
        [set pcolor white]
        [set pcolor black]
      ]
      set j j + 1
    ]
    set i i - 1
  ]
  file-close-all
  </code></pre>
  
  <p>I want to remove that repeat 33 loop and have a while loop to use with variably sized worlds.</p>