Project 369: Collecting Coins

6. Add a loop to create multiple coins

Create a loop to create some number of coins. In our case we’re creating 40 coins.
Starting point file for this challenge

Steps

1. Create local variable 'totalCoins'

Outside of the function, create a local variable called `totalCoins` to keep track of how many coins we’ve created. This needs to be created outside the loop so it doesn’t reset every time the loop runs. Start this number at 0.
local totalCoins = 0

2. Make a while loop

Create a while loop that keeps running as long as 'totalCoins' is less than 40. 
while totalCoins < 40 do end

3. Create a coin

Make it so that each iteration of the loop runs the 'CreateCoin( )' function.
CreateCoin()

4. Add 1 to 'totalCoins'

Make it so that each iteration of the loop adds 1 to the 'totalCoins' variable.
totalCoins = totalCoins + 1

5. If you wanted to create 60 coins, what would you need to change?

Don't actually change your code, but make sure you tell your instructor what you think the answer is before moving on.