"You must take your chance; / And either not attempt to choose at all, / Or swear before you choose, if you choose wrong, / Never speak to lady afterward / In way of marriage" (2.2.38-42).
"Who chooseth me shall gain what many men desire'" (II.VII.37).
Here, we get the details of Portia's father's scheme for picking her suitor. There are three chests, made of gold, silver, and lead, each with an inscription. Inside one chest is a picture of Portia; if a suitor chooses the chest with the picture, he can marry her. Otherwise, he dies alone.
"Why, that's the lady: all the world desires her; /...Deliver me the key: / Here do I choose, and thrive I as I may!" (2.7.38 -2.8.59-60).
The Prince of Morocoo arrives in an attempt to win Portia`s hand in marriage. Portia leads the Prince to the caskets and reminds him that the penalty for guessing incorrectly is that he must remain unmarried forever.
"But my outside to behold: / ... Had you been as wise as bold, / ... Your answer had not been inscroll'd. / Fare you well, your suit is cold" (2.8.68-73).
"All that glisters is not gold;" (II.VIII.65).
The Prince of Morocco sets about choosing a chest. He goes over each of the inscriptions and reasons to himself.
"Portia, adieu. I have too griev'd a heart / To take a tedious leave; thus losers part" (2.8.76-77).
When it is time for the Prince to choose he decides that lead is too worthless, and silver is of less worth than gold, so gold is the only thing worthy enough to hold Portia's picture.
When the Prince opens the golden casket, he finds a skull and a scroll. The berating inscription says that what is golden outside is not always golden inside, and the chooser would have known this had he been as wise as he was bold.
As a result of choosing incorrectly, the Prince is condemned to a life of solitude and leaves quickly and quietly. Portia gladly lets him go.