# Exploring Languages with Interpreters and Functional Programming
# Copyright (C) 2018, H. Conrad Cunningham

#234567890123456789012345678901234567890123456789012345678901234567890

# 2018-07-04: Developed prototype for procedural Python example
# 2018-09-19: Rename CountingProc.py, 

# python3 CountingProc.py

def counter(count,maxc):
    def has_more(count,maxc):   # new variables
        return count <= maxc 

    def incr():
        nonlocal count          # from counter
        count = count + 1

    while has_more(count,maxc): # counter body
        print(f'{count}')
        incr()

# Testing when called as main
if __name__ == '__main__':
    counter(0,10)

