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.
Ruby Control Structures - Case (Bonus Question)
Ruby Control Structures - Case (Bonus Question)
Sort by
recency
|
82 Discussions
|
Please Login in order to post a comment
why is: *case obj * and not: case obj.class
If you're doing the same thing for each case, a case statement doesn't really make sense in my opinion.
Here's a predicate that includes all of the conditions:
You can use string interpolation (like in truesdell_trent1's comment here ) or just concatenation (with
obj.class.name
) to output the class names.https://bestbeardstraightener.com/