Implement a Python function to find the smallest element in an array
[3, 5, 2, 1, 4]
def findSmallest(arr):
    smallest = arr[0]
    for i in arr:
        if i < smallest:
            smallest = i
    return smallest

findSmallest([3, 5, 2, 1, 4])
# Output: 1