Added an array function with a for loop and nested for loop