mardi 3 septembre 2019

What is 'in?' in ruby?

I am stuck here in code when I use in? method in ruby as follow:

'ruby programming'.in?('ruby')
=> false 

'ruby programming'.in?('ruby programming')
=> true

['ruby'].in?('ruby')
=> TypeError: no implicit conversion of Array into String

This method is like a include?, but behaving differently for different objets.

what actually doing in? method?

Aucun commentaire:

Enregistrer un commentaire