Of Course

"Of Course" is the 17th episode of the fifth season of the CBS sitcom How I Met Your Mother and 105th episode overall. It originally aired on March 8, 2010.

Plot
One night in March 2010, the New York Police Department's river patrol pulls Barney out of the Hudson River. Barney explains to a police officer the chain of events that started one week before.

He had picked up Anita (Jennifer Lopez) at MacLaren's. However, she suddenly leaves him just as they were making out at his place. Meanwhile, Robin and Don, who have established good chemistry on their morning show, hang out with Marshall and Lily at the bar. Marshall encourages Robin to keep Don and, later, even pretends to be Robin when accepting Don's date invitation.

Later, at Ted's apartment, Barney tells the gang of his failure to snag Anita. Ted speculates that she may have read a book called Of Course You're Still Single, Take a Look at Yourself, You Dumb Slut. Ted claims the book is Robin's, but the gang do not believe him. Barney confronts Anita, and she asserts that the book encourages women to be powerful and not to rely on untrustworthy men. Much to Barney's frustration, the book also recommends waiting 17 dates before consummating a relationship. When checking the book for a loophole, Barney discovers Anita is the author and devises a plan to seduce her into breaking her 17 dates rule. Later, Robin admits to Marshall and Lily that when Anita was a guest on her show, they hatched a plan to teach Barney a lesson.

Marshall confesses to Lily of his regret that he pushed Robin to keep up with Barney's sexual activity after their breakup and his guilt over concocting a song: "bang, bang, bangity-bang". Barney tells Ted about his failure to develop a counter-strategy to Anita's book. Ted concocts a strategy, in song, to combine 17 dates into one "super-date", which Barney says is gooey and romantic. However, Ted also informs Robin, causing her to cancel her date with Don. Marshall is angry with Ted for crushing Robin; Ted and Barney had joined Marshall to sing "bang, bang, bangity-bang". Ted realizes he had been a jerk to Robin after her breakup with Barney; he and the gang go and hug Robin.

Later at Barney's apartment, Lily yells at him about the occasions when Robin cried and vented her frustration at the shooting range after hearing Barney brag about his sexual conquests. Barney heads to the shooting range and apologizes for preparing a wonderful date for Anita when he had never treated Robin that way. He decides to let Robin and Don go on the "super-date", promising he will not sleep with Anita.

Later, Anita confronts Barney for standing her up, but becomes flustered when he uses her own "No" strategy against her. Barney is defiant and Anita offers him compromise offers, the last of which prompts him to jump into the Hudson in an effort to keep his promise to Robin. After finishing his story, Barney is fined $500 for the misdemeanor, and watches the skyline as Don and Robin kiss during the fireworks display that marks the ending of the "super date". The following morning, Robin refuses to discuss the date with the gang, but then breaks into the "bang, bang, bangity-bang" song; everyone joins in except for Barney, who enjoys being mocked himself for a change.

Critical response
Donna Bowman of The A.V. Club rated the episode with a grade A−.

Brian Zoromski of IGN gave the episode 9 out of 10.

James Poniewozik of Time criticized Jennifer Lopez's acting: "while I liked her appearances in movies like Out of Sight she now became one of those celebrities I have hard time seeing as anyone other than herself, especially when playing a guest role".