You are viewing a single comment's thread. Return to all comments →
i tried this way not working
def identify_class(obj) case obj when Hacker,Submission,TestCase,Contest puts "it's #{obj.class}!" else puts "it's an unknown model" end
# write your case control structure here
end
Seems like cookies are disabled on this browser, please enable them to open this website
Ruby Control Structures - Case (Bonus Question)
You are viewing a single comment's thread. Return to all comments →
i tried this way not working
def identify_class(obj) case obj when Hacker,Submission,TestCase,Contest puts "it's #{obj.class}!" else puts "it's an unknown model" end
end