We use cookies to ensure you have the best browsing experience on our website. Please read our
cookie policy
for more information about how we use cookies.
Ok
HackerRank
|
Prepare
Certify
Compete
Apply
Hiring developers?
Log In
Sign Up
Prepare
Ruby
Control Structures
Ruby Control Structures - Case (Bonus Question)
Discussions
Ruby Control Structures - Case (Bonus Question)
Problem
Submissions
Leaderboard
Discussions
You are viewing a single comment's thread.
Return to all comments →
tatjana87
6 years ago
+ 0 comments
This code passed both tests:
def identify_class(obj)
case obj
when Hacker then puts "It's a Hacker!"
when Submission then puts "It's a Submission!"
when TestCase then puts "It's a TestCase!"
when Contest then puts "It's a Contest!"
else puts "It's an unknown model"
end
end
Ruby Control Structures - Case (Bonus Question)
You are viewing a single comment's thread. Return to all comments →
This code passed both tests: