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

java - Null response to php query in android, even though php works properly -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -