# demonstrate general pattern for iterating through characters
# of a string using while.
#
def loopChars(inputString):
    result = ""
    currentIndex = 0
    while currentIndex < len(inputString):
        currentChar = inputString[currentIndex]
        #
        # body of loop - typically do some computation
        # using character currentChar
        #
        result = result + currentChar + currentChar
        #
        print(currentChar, currentIndex)
        #print(result)
        currentIndex = currentIndex + 1

    return result

# demonstrate general pattern for iterating through characters
# of a string using for.  Understand that this and loopChars() are equivalent.
#
def loopChars2(inputString):
    for currentChar in inputString:
        #
        # body of loop - typically do some computation
        # using character currentChar
        #
        print(currentChar + currentChar)

