Talk:Exception handling syntax
Appearance
Hi,
there is a followin snippet of pseudocode in Exception handling:
try { line = console.readLine(); if (line.length() == 0) { throw new EmptyLineException("The line read from console was empty!"); } console.printLine("Hello %s!" % line); } catch (EmptyLineException e) { console.printLine("Hello!"); } catch (Exception e) { console.printLine("Error: " + e.message()); } else { console.printLine("The program ran successfully"); } finally { console.printLine("The program terminates now"); }
in indicates that a program can act in some way when everything went successfully and in a different way if something was broken. I am missing in my knowledge how to make that "if error {} else {}". Could you, please, extend and edit this article (at least for C++) so I can learn how to implement it really? Thank you in advance!