title: How To Limit The Number of Times A Struct is Looped Through in Go?
body: <p>I am trying to have a <code>Struct</code> only be looped through ten times before stopping. My <code>Struct</code> looks like</p>
  <pre><code>type Book struct {
      Id string
      Title string
  }
  </code></pre>
  <p>and the code that will loop through the entire thing is</p>
  <pre><code>var books []Book;
  for _, book := range books {
      fmt.Println(book.Id + &quot; &quot; + book.Title);
  }
  </code></pre>
  <p>I have tried using a separate for loop that will go ten times but that has only looped through the entire <code>Struct</code> ten times or did one part of the <code>Struct</code> ten times.</p>