Last active
June 6, 2020 19:21
-
-
Save rydrman/0c2a3ed69ceb9de134c022d28b82ffda to your computer and use it in GitHub Desktop.
Function example exiting as soon as possible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getValue() int { | |
if !condition { | |
return alternative() | |
} | |
value := someBase() | |
if !shouldMore { | |
return value | |
} | |
return value + more() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment