When I ran size and length on a string, they returned the same value.
"akash".size # => 5
"akash".length # => 5
What is the difference between these two methods?
When I ran size and length on a string, they returned the same value.
"akash".size # => 5
"akash".length # => 5
What is the difference between these two methods?
Contrary to what others have said, there is at least one differences between .length and .size in terms of usage.
.size may be used on integers, whereas .length raises a NoMethodError.