Session 2: Exercise
EXERCISE 1:
Create a variable which holds a string for the name of your best friend, all lower-case
Output:
- The length of their name
- Their name reversed
- Their name with only the first letter capitalized (think about Ranges!)
Questions for exploration:
- Go to the Ruby documentation page for String. What other methods do you see here? What can you make with them?
EXERCISE 2:
- Create a variable which holds a Hash of a few names and ages
- Create a variable which holds the name of one of the people from the Hash
- Output in a complete sentence, the name and age of the person you selected by using a Hash lookup