Skip to content

Instantly share code, notes, and snippets.

@jgv
Created August 21, 2012 04:41
Show Gist options
  • Save jgv/3411623 to your computer and use it in GitHub Desktop.
Save jgv/3411623 to your computer and use it in GitHub Desktop.
avg := Object clone
avg myAverage := method(l,
for(i, 0, l size, if (l at(i) type != "Number", "not a number" println return))
if (l type == "List", if(l size > 0, l average, "blank list"), "not a list"))
avg myAverage(list(1, 2, "three")) println
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment