I always carry when I'm out walking. The other night I was almost attacked by a loose dog. The dog charged me from out of nowhere so I pulled my glock 19 with a utac 200 lumens light on it aimed started yelling get back and the thing kept coming. I turned my strobe setting on and it stopped dead in its tracks. Luckily I didn't have to pull the trigger. Now I always bring my light on evening walks.
^This is the way to go right here.
Most dogs will stop with aggressive yelling, fake rock throwing (or real rock) and standing your ground. At least this has been my experience in many, many cases (former H.S running, avid hiker, and walker with the family).
But you always worry about that one beast which is either rabid, or doesn't fall for the "I'm the bigger dog" trick.