How Blocks Differ from Methods, more info?


#1



https://www.codecademy.com/courses/ruby-beginner-en-ET4bU/2/2?curriculum_id=5059f8619189a5000201fbcb


I am new to this and was wondering if I could get more of an explanation as to what this means:

string[0] refers to the first character in the string; string[1..-1] refers to the range of the second through final characters. Therefore, the method prints out the capitalized version of the first character and prints the second through final characters as-is.

I understand what it does, but still don't understand why it works. Any insight would be appreciated.


Replace this line with your code.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.