def cbf_end_loop(array, apointer, inputdata, output, source, spointer):
    """
    End loop. However, it is possible to have an end loop operator 
    ("]") without a preceding start loop operator ("["). In this case, 
    the end loop operator ("]") will be ignored and execution continues. 
    Note that unclosed or unopened loops may result in non-deterministic 
    behaviour. 
    """
    temp = spointer
    if array[apointer] < 1:
        return array, apointer, inputdata, output, source, spointer + 1
    else:
        count = 1
        try:
            while count > 0:
                spointer = spointer - 1
                if source[spointer] == ']':
                    count = count + 1
                if source[spointer] == '[':
                    count = count - 1
        except IndexError:
            spointer = temp
    return array, apointer, inputdata, output, source, spointer
