Ruby uses begin, rescue, ensure, and end to handle errors.
begin
rescue
ensure
end
Ruby comes with a built-in module for logging, Logger, that’s super easy to use.
Logger
Imagine you’re writing a quick script to greet users.
Let’s go through an example of refactoring a Ruby method that calculates the sum of squares.