a = nil
if a =~ /a/
end
if a.match /a/
#why error ?
end
a = nil
if a =~ /a/
end
if a.match /a/
#why error ?
end
Because match is not defined on NilClass, but =~ is defined on Object,
which is the superclass of NilClass.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs