Ruby - Variables and Data Types
Which of the following is the correct syntax to check if variable
obj is exactly an instance of class String?obj is exactly an instance of class String?.instance_of? returns true only if the object is exactly of the given class, not subclass..is_a? and .kind_of? allow subclasses; .class == String works but is less idiomatic.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions