HomeChallengesRepsProblemsLeaderboardTake a challenge

Where null gets in

Code that passes every test and throws in production. Make the compiler find it.

Beginner18 min on the clock5 graded checks · 100 pointsC# Foundations
Graded by reading your code against the checklist below.

What you build

  • Say in the signature which things are allowed to be null
  • Reach through a possibly-missing value safely
  • Supply a fallback rather than returning null
  • Reject a null argument at the door, with a message
  • Do not silence the compiler with the null-forgiving !

Done means

No path through this method can dereference null.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Annotate what is allowed to be null+25Null, and where it gets in
  2. Reach through it safely+20Null, and where it gets in
  3. Supply a fallback instead of returning null+20Null, and where it gets in
  4. No null-forgiving operator+20Null, and where it gets in
  5. Reject a null argument at the door+15Null, and where it gets in

What it teaches

The rest of C# Foundations