-
-
Save loren-osborn/6c4d9593ec75abf53699 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code: | |
def foo(bar, *baz, &block) | |
puts "trying to call foo #{@bar} (#{@bar.class.to_s.to_sym}) *baz = #{@baz} (#{@baz.class}) &block = #{@block} (#{@block.class})\n" | |
if (bar == nil) || (bar.class == NilClass) || [*bar].empty? | |
puts "firing exception\n" | |
raise "There should be data here" | |
end | |
end | |
program output: | |
trying to call foo (NilClass) *bar = (NilClass) &block = (NilClass) | |
question: | |
How the function being called that the output is as shown without printing "firing exception"? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment