Why does respond_to? need symbols as arguments in Ruby? -


why method accept symbols , not strings arguments?

x = 10 x.respond_to?(next) 

pushing string above throw (ruby):1: void value expression.

it accept strings:

x = 10 x.respond_to?('next') # => true 

your problem didn't pass string, next keyword.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -