January 2024
Intermediate to advanced
718 pages
20h 15m
English
The method catch executes its associated block:
The method throw interrupts the normal processing of statements:
When a throw is executed, Ruby searches up the call stack for the first catch block with a matching object. If it’s found, the search stops, and execution resumes past the end of the catch’s block. If the throw is passed a second parameter, that value is returned as the value of the catch. Ruby honors the ensure clauses of any block expressions it traverses while looking for a corresponding catch.
If no catch block matches the throw, Ruby raises an ArgumentError exception at the location of the throw.
Read now
Unlock full access