Functional Programming, Csharp, Programming.
to change the returned type. Something simple like changing int to int? will do the work. static class Math { public static int? Divide(int a, int b) { if (b == 0) return null; return a / b; } } By doing so, the caller code will know that the result may not exist and is forced to handle this case.