This is quick blog post about stopping executing void method. So, how to stop executing void return type method? We just need to use ‘return’ statement itself, for example:
public static void sum(int a, int b)
{
if (a == 0) return;
Console.WriteLine(a+b);
}
If we pass 0 as first argument then we won’t get print from next line.