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

# Modular programming example from Chapter 2

#234567890123456789012345678901234567890123456789012345678901234567890

# 2018-07-04: Developed prototype for modular example
# 2022-03-14: Renamed incr() as adv(), made has_more() argumentless

# python3 CountingMod.py

count =  0
maxc  = 10

def has_more():
    return count <= maxc

def adv():
    global count 
    count = count + 1

def counter():
    while has_more():
        print(f'{count}')
        adv()

# Testing
if __name__ == '__main__':
    counter()

