in reply to Re^2: i dont like the way my code looks but work
in thread i dont like the way my code looks but work

If you declare my %total inside the loop, it will be only be visible inside the loop - and reset every time the loop starts over. Certainly not what you want.