0

[SOLVED] The throw keyword

What is the function of the throw keyword in the try-catch statement? I'm using the Visual Studio, and the try-catch snippet contains the throw keyword like this one below : try { } catch(System.Exception e) { throw; }

27th Oct 2018, 5:24 AM
Rafi Hazel Tafara
Rafi Hazel Tafara - avatar
3 Answers
+ 1
The snippet probably uses it to remind you to do something in the catch block. (If you don't, your program blows up)
27th Oct 2018, 7:20 AM
Schindlabua
Schindlabua - avatar
0
throw keyword is used to bypass the exception in. the code
27th Oct 2018, 5:29 AM
Suhail Ahmad
Suhail Ahmad - avatar
0
try: { cou<<"sololearn"<<endl; // Incorrect } catch: { error; // Hey it should be "cout" not "cou" } throw: { cout<<"hi"<<endl; // I catched and displayed the error on the screen and I will continue executing next line of code }
27th Oct 2018, 10:37 AM
onekpsc