Suppose I need something like this.( This code is blunder, but just an example). This code is not my problem! Its just an example. I know how to write it using if else statements. I'm considering a more complicated Context!
int[] arraynums = new int[3] {1,2,3};
int Sample = 0;
try
{
Sample = arraynums[3];
}
catch
{
Sample=4;
}
Here I can use an alternative logic which wont't run into an error. But still I can reduce the code if I use try catch block. Is it advisable to use a try catch block to solve a logic? If no, then why?