C#C
C#16mo ago
30 replies
Merineth

✅ Exception handling

I'm trying to understand exceptions but i'm having a hard time.
So when an error occurs in my program. For example :
int number = Console.Readline();
Console.Writeline($"{number}");


If the input here in this case wasn't an integer but a string. The program would crash right?
And to prevent it from crashing we use exception handling with try and catch ?
Was this page helpful?