Groovy web console

subscribe to the feed Subscribe
to this
site

Sum of ints

Published 4 weeks ago by glaforge
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def data = [1, 2, 3, 4, 5]
def s = data.sum { it ** 2 }
println "Sum of some ints: $s"