5 lines
108 B
Text
5 lines
108 B
Text
mean = { list |
|
|
true? list.empty?, 0, { list.reduce(0, :+) / list.length }
|
|
}
|
|
|
|
p mean 1.to 10 #Prints 5.5
|