C#C
C#3y ago
Question

❔ ✅ How to store a method's variable to main method?

I'm creating a simple ATM program, but I've encountered an issue:

I have created a method called "withdraw", the purpose of this method is to subtract a "WithdrawAmount" entered via the parameter to the users current balance.

I've managed to correctly have it subtract the balance, but I do not know how to store that result as a variable and bring it back to my main method?

the aim is to update the balance in my main method to the new balance after a withdraw has been made

I've attempted to use a return statement, but no luck.
Was this page helpful?