notexOPENOverview
Notex/Languages/Code Review: functions, parameters, and return values
03.08LESSON 08 OF 18 · 1 MIN READ

Code Review: functions, parameters, and return values

Always free to read
  • A function shouldn’t have a lot of parameters. Make sure your function isn’t doing too much.

  • Outside of fmt.Println and other well-known functions, use _ to explicitly mark ignored return values.

  • Never use a blank (naked) return in a function that returns values. It forces the reader to scan the entire function to figure out what value is being returned.

  • Watch out for shadowing named return values. Confirm that you’re assigning to the return variable, not accidentally creating a new one with :=.

Progress is saved on this device.
KEEP EXPLORING

One note leads to another.

Back to the library →
⌕
Search across the entire library ⌘ K