RosettaCodeData/Task/Averages-Arithmetic-mean/Brat/averages-arithmetic-mean.brat
Ingy döt Net 518da4a923 B
2013-04-10 16:19:29 -07:00

5 lines
108 B
Text

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