I need to keep track of each loop and average an input that needs to be keep tracked across all loops
Not sure if this is what you mean, but if you define the data outside of the while loops (as a public object or just earlier in the method before the loops start) then you’ll be able to access them in any of your loops.
(if my terminology is off, it’s cuz I’m pretty new to programming but) hope this helps
Make the variable before the loops start. The way it is out of each loop scope.
In simple terms every { } is a scope. Variables can only be accessed up to the scope they were created in. So for example
a can be accessed anywhere in the method. But b can only be accessed inside the loop. So basically create your variables before the loop.
C# devs
null reference exceptions