~statianzo/sevenlangs

sevenlangs/io/myAvg.io -rw-r--r-- 219 bytes
2fcd4511Jason Staten day one logic style 2 years ago
                                                                                
1
2
3
4
5
6
7
8
List myAvg := method(
  if(isEmpty, 0, (self sum) / (self size))
)

list(0, 100) myAvg println      # 50
list(100) myAvg println         # 100
list() myAvg println            # 0
list(1,2,"three") myAvg println # Error