How to Array Sum in Groovy - Code Snippet

How to perform 'Array Sum' in Groovy.

example.groovy
// Task: Array Sum
// Language: Groovy

def array_sum() {
    // Implementation for Array Sum
    def result = ...; // Initialize variable
    // TODO: Implement core logic here
    // Step 1: Prepare data
    // Step 2: Process Array Sum
    println("Done");
}
AdSense Slot