C# C# Basics (Retired) Perform Converting Strings to Integers

Edward Zhou
Edward Zhou
401 Points

why do you need "int runningTotal = 0" in the beginning?

why do you need "int runningTotal = 0" in the beginning? especially when the total is definitely not zero.

2 Answers

Hi, the integer variable must be set otherwise the program won't know where to start from. If you didn't have runningTotal then you wouldn't be able to add up and show the client how many minutes they've worked out for..

It's basically a container to add all the clients minutes and display it.

At the very beginning before anyone adds minutes for the first time, the total IS zero.