Many comic instances can be found in Twelfth Night. One of the best takes place at the climax and is the moment when Viola as Cesario is challenged to a duel by Sir Andrew. This scene is especially comical because of all of the irony it contains, especially dramatic irony. Dramatic irony is a moment when the audience understands far more about the character's situation than the character understand.
Sir Andrew was brought to the house by Sir Toby as a prospective suitor for Olivia. Hence, Sir Andrew becomes exceedingly jealous when he sees Olivia falling for and paying more attention to Cesario, the Duke's servant. At Sir Toby and Fabian's encouragement, Sir Andrew decides to challenge Cesario to a duel, which leads to a great deal of comic irony. One point of irony is that since Cesario is really Viola, a woman, she has had absolutely no education in sword fighting. This is also dramatic irony because the other characters believe she is a man. Viola fears for her life and nearly decides to expose her identity. Another point of irony is that Sir Andrew is actually a coward though he is a knight, and when Sir Toby describes Cesario as a "very devil" and a fearsome sword fighter, even a "fence to the Sophy," meaning a fencer for the King of Persia, Sir Andrew becomes terrified, wishing to back out of the challenge (III.iv.257-62). At the same time, Viola is being told that Sir Andrew is a very valiant knight and an excellent fighter. Hence, the final point of dramatic irony is both Cesario and Sir Andrew believe things about each other that are absolutely false, leading to the further irony that when Cesario and Sir Toby are finally brought to face each other, both practically being dragged by Sir Toby, both are too terrified to fight. Sir Andrew prays that Cesario keeps his promise not to hurt him during the duel, while Viola draws her sword saying, "I do assure you 'tis against my will" (290-91). When they are interrupted by Antonio who offers to answer Sir Andrew's challenge on Cesario's behalf, whom Antonio believes to be Sebastian, Viola quickly puts an end to the duel by asking Sir Andrew to put away his sword. Plus, as a final act of comedy, Sir Andrew, who had challenged Viola as Cesario in the first place, says he will gladly put away his sword and promises to give Cesario his horse for not killing him, as we see in Sir Andrew's lines:
Marry, will I, sir; and, for that I [the horse] promised you, I'll be as good as my word; he will bear you easily and reins well. (303-05)
Since both Viola and Sir Andrew are terrified in this scene, and both are led to believe things about the other that are opposite, this scene contains many examples of dramatic irony, and the irony helps create the humor.