One of the toughest aspects of being a leader is that you're always onstage. People are always watching you, always talking about you, always testing your credibility. That's why setting the right example is so important, and why it's essential to make use of all the tools you have available to set the example. If your own words, as leaders, why do you think it is important to set the example so you can lead and teach others effectively.
Leading by example starts at an early age. Children learn social cues, communication skills and even decision-making abilities by watching their parents. If a child is raised in an environment where adults yell at each other, or ignore each other and perhaps even openly lie to one another; these examples are showing (and by default telling) the child what is the "right" way do interact. The workplace is really no different, aside from having leaders/managers in the "parent" role and employees as the "children" who are watching and analyzing their every move.
In the context of being a leader in a work environment, leading by example is paramount to garnering respect of subordinates. The quickest way to lose respect would be to lead by "Do as I ...
This solution is over 400 words and provides several examples of what a leader can do to ensure they are leading by setting good examples. The solution discusses how leaders must gain respect, trust and creditability, specific to a work environment. Employees will not respect leaders who say one thing, but do another. Leaders who engage in office politics or "playing favorites" will quickly find employees see this unfair treatment and do not trust them.