part 1 task 0
This commit is contained in:
parent
543eb21595
commit
309088e5d2
12
Lab11.iml
Normal file
12
Lab11.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="scala-sdk-2.13.12" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
9
src/TestArray.scala
Normal file
9
src/TestArray.scala
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
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))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user