title: In Kotlin, how can I take the first n elements of an array
body: <p>In Kotlin, how can I take the first n elements of this array:</p>
  
  <pre><code>val allColours = arrayOf(
      Pair(Color.RED, Color.WHITE), 
      Pair(Color.RED, Color.BLACK), 
      Pair(Color.YELLOW, Color.BLACK), 
      Pair(Color.GREEN, Color.WHITE), 
      Pair(Color.BLUE, Color.WHITE), 
      Pair(Color.BLUE, Color.WHITE), 
      Pair(Color.CYAN, Color.BLACK), 
      Pair(Color.WHITE, Color.BLACK))
  </code></pre>
  
  <p>So how can I fill <code>pegColours</code> with the first say 3 Pairs?</p>
  
  <pre><code>var pegColours: Array&lt;Pair&lt;Color,Color&gt;&gt; = //???
  </code></pre>
  
  <p>I tried <code>allColours.take</code> but it gave an error:</p>
  
  <blockquote>
    <p>Expecting an element</p>
  </blockquote>