added a second code example with an array as input