I would like my variable res
to be updated inside the loop, but it does not update until after the second iteration.
Here is my code:
@echo off
set /a res=10
:loop
if %res% gtr 100 (
goto endLoop
) else (
set /a res=res*10
rem Here the 'res' shouldn't it be 100?
echo the result is : %res%
rem Here the first iteration display 10 not 100.
goto loop
)
:endLoop
pause > nul
Is there an explanation for this?