sum of the examples for loop and functions