PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Exceptions

Exceptions

Exceptions are a language feature.

In general, an exception breaks the normal flow of execution and executes a pre-registered exception handler.

Languages with Exceptions include Java, JavaScript, C++, PHP, Ruby, C#, Scala, Swift, Kotlin, PowerShell, Dart, Groovy, CoffeeScript, Solidity, X10, ABAP, Apex, Sophia

Example from JavaScript:

try { undefinedFn() } catch (err) { console.log(err) }

Example from Ruby:

def hello puts "Hello, World!" # start an exception handler begin raise "This is an exception" rescue => e puts "Exception caught: #{e}" end end hello

Article source

PLDB - Build the next great programming language 路 v2022 Docs Acknowledgements Email GitHub