Title here
Summary here
Based on the provided Groovy language specification and the Go code example, the translated code and explanation in Groovy will be as follows:
Here we use the each
method to sum the numbers in a list. Arrays work like this too.
each
on lists provides both the index and value for each entry. Above we didn’t need the index, so we ignored it. Sometimes we actually want the indexes though.
each
on maps iterates over key/value pairs.
each
can also iterate over just the keys of a map.
each
on strings iterates over each character of the string.
Next example: Pointers.