Create a Python module that takes in an array and returns the greatest common divisor (GCD).
[30, 42]
def gcd(arr):
    gcd = arr[0]
    for i in arr[1:]:
        while i:
            gcd, i = i, gcd % i
    return gcd

arr = [30,42]
print(gcd(arr))