Automate the task of checking if an array of numbers is in sorted order using a Python program.
[2, 3, 6, 4, 8]
def is_sorted(nums):
    for i, num in enumerate(nums[:-1]):
        if num > nums[i + 1]:
            return False
    return True