Search⌘ K
AI Features

Exercise 1: Chaining

Explore method chaining in Ruby by solving a problem that combines the lengths of two strings. This exercise helps you understand string objects and method calls, reinforcing fundamental Ruby object concepts.

We'll cover the following...

Problem statement

We have two strings, first_name and last_name. Find the combined length of both strings.

Example

first_name = 'alex'
last_name = 'smith'
result = 9

Try it yourself

Ruby
def find_length(first_name,last_name)
# Start your code here
return result
end