PRACTICE / UNDERSTAND / REPEAT

Go: Errors

Practice errors with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

16 questionsAnswers explainedFree · no login
Question 1 of 16
Errors · MCQQuestion link ↗

What is the conventional Go error check after a function returns `err`?

Choose one answer
Answer & explanation

Answer: if err != nil { return err }

Go represents errors as values; callers commonly compare the returned error with `nil`.