Yes a dog can walk even when the dog has a broken leg.
When a dog has a broken leg the dog will not want to put any weight on that broken leg and will usually walk with the leg up in the air.
If you notice your dog walking with a leg up in the air or not willing to put any weight on a certain leg then the dogs leg could be broken.
However it could also mean the dog has something in it's paw such as a piece of glass, a thorn or something else.
When a dog has a broken leg the dogs leg will usually be at an awkward angle and the dog may have intense pain, swelling of the paw, leg etc.
If you think your dogs leg may be broken you should take the dog to the vet to get the dog checked out.