title: How to create a fixed size IntArray and initializing the array later in Kotlin?
body: <p>I can't figure out a way to add values to an array in Kotlin .</p>
  
  <p>I want to get values from user and add them to the array.</p>
  
  <pre><code>val arr = arrayOf&lt;Int&gt;()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>var arr = intArrayOf()
  </code></pre>
  
  <p>In Java I would do something like this:</p>
  
  <pre><code>Scanner ob = new Scanner(System.in);
  int arr[] = new int[5];
  for (int i = 0; i &lt; arr.length; i++) {
     arr[i]=ob.nextInt();
  }
  </code></pre>
  
  <p>How can I do the same in Kotlin?</p>