Bank Account Part 1

5. The Withdraw Function

Very similar to the deposit function, only the withdraw function is taking a parameter for the amount to withdraw. Here there need to be some checks done, and you should find a way to tell the user if they are unable to withdraw the amount they would like to. Again, this function should return the value that is being withdrawn so that the updateBalance function can do it's job.

If your updateBalance function is able to change the balance in a positive way, think about mathematically how we could use the same structure, but in a negative way? Something about adding a negative number really means to ...
Hint Remember that when a function returns something, that means that wherever the function call happens, that same block will get turned into the number that is returned by this function.
Next
Back