all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
14
Task/Stack-traces/Ruby/stack-traces-1.rb
Normal file
14
Task/Stack-traces/Ruby/stack-traces-1.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
def outer(a,b,c)
|
||||
middle a+b, b+c
|
||||
end
|
||||
|
||||
def middle(d,e)
|
||||
inner d+e
|
||||
end
|
||||
|
||||
def inner(f)
|
||||
puts caller(0)
|
||||
puts "continuing... my arg is #{f}"
|
||||
end
|
||||
|
||||
outer 2,3,5
|
||||
19
Task/Stack-traces/Ruby/stack-traces-2.rb
Normal file
19
Task/Stack-traces/Ruby/stack-traces-2.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
def outer(a,b,c)
|
||||
middle a+b, b+c
|
||||
end
|
||||
|
||||
def middle(d,e)
|
||||
inner d+e
|
||||
end
|
||||
|
||||
def inner(f)
|
||||
raise
|
||||
puts "this will not be printed"
|
||||
end
|
||||
|
||||
begin
|
||||
outer 2,3,5
|
||||
rescue Exception => e
|
||||
puts e.backtrace
|
||||
end
|
||||
puts "continuing after the rescue..."
|
||||
Loading…
Add table
Add a link
Reference in a new issue