memesearch
Early Return Is Not Great

Early Return Is Not Great

Download Find similar pictures
Text on the meme
Early return is actually not great Early return is probably the most underrated practice, even among experienced developers. // Instead of this func Do() { if cond_1 { // do stuff if cond_2 { // do more stuff if cond_3 { // do even more stuff } } } } // Do this func Do() { if cond_1 { return } // do stuff if !cond_2 { return } // do more stuff if !cond_3 { return } // do even more stuff }
What it means

A programming meme contrasts deeply nested conditional logic with an early-return style. The joke is that early returns are often praised as a best practice, but the post humorously argues that they are actually not great in this example, especially when the conditions are written negatively. EN: A programming meme contrasts deeply nested conditional logic with an early-return style. The joke is that early returns are often praised as a best practice, but the post humorously argues that they are actually not great in this example, especially when the conditions are written negatively.

Objects
Tags
Source
Type
image
Size
589×492 · 31.4 KiB
Mood
sarcastic, absurd
Language
en
Added