Example code:
@echo off
set money=0
echo How Much Do You Want To Deposit?
set /p "moneyPut=>"
set /a money=%money% + %moneyPut%
Can this work?
Example code:
@echo off
set money=0
echo How Much Do You Want To Deposit?
set /p "moneyPut=>"
set /a money=%money% + %moneyPut%
Can this work?
Yes that will work. The assignment of money= is the last thing that occurs. The current value of %money% is evaluated first, like most (all?) other programming languages.
To answer your question; yes, you can. The old value is simply overwritten with a new value. You can use the old value to define the new value though, just like you use the old value of money
together with the value of moneyput
, to define the new value of money
, in your example code.
I tested your example code, and found it to be working fine, so more information on how exactly you find it isn't working would be useful.