logoalt Hacker News

mahboi • today at 9:53 PM • 1 reply • view on HN

Guard clauses are things that return early for trivial or problematic cases. Like https://en.wikipedia.org/wiki/Guard_(computer_science)#Flatt...

They're one of those good practices that look like bad practice to everyone who just got a CS degree. Seems ex-students are unsettled by asymmetry or want to minimize the number of return statements.


Replies

ramesh31 • today at 10:27 PM

Particularly for high performance code when branch prediction is taken to account