Ruby Global $! (DollarBang) - rking/pry-docmore GitHub Wiki
The $! global is the Exception set by 'rescue'
This code:
begin
raise 'hi'
rescue
p $!
end
p $!
Prints this:
#<RuntimeError: hi>
nil
The $! global is the Exception set by 'rescue'
This code:
begin
raise 'hi'
rescue
p $!
end
p $!
Prints this:
#<RuntimeError: hi>
nil