Method name not using snake_case

Is this method name correct?


Hi @Aldo_Escudero,

You’re right. This method is not written in snake_case. We can use this name in Ruby, but it is not the convention. In Ruby, the convention for method names is to use snake_case, where words are separated by underscores. For example, a method to calculate the sum of two numbers could be named count_days.

However, Ruby does allow us to use other method names (camelCase), and it is perfectly valid syntax. So, one can name the same method as count_Days if preferred.

It’s worth noting that using the convention for method names in Ruby can make your code more readable and easier to understand for other developers. Therefore, it’s generally a good idea to stick to the convention and use snake_case for method names. You can update this method name to count_days.


Hi @Komal_Arif,

What worries me is that in the past I have taken job interviews where the employer checks how you deal with Ruby conventions.

Thanks for your quick reply!


1 Like