object TestArray extends App {
  def arrayAvg(arr: Array[Double]): Double = {
    if (arr.isEmpty) return 0
    return arr.sum / arr.length
  }

  val arr: Array[Double] = Array.range(1, 1001).map(i => i.toDouble)
  println(arrayAvg(arr))
}
