Search⌘ K
AI Features

Exercise 3: Make an Expression

Explore how to manipulate arrays in Ruby by creating expressions from their elements with plus signs. This lesson helps you practice and understand array handling and string creation using built-in classes in Ruby.

We'll cover the following...

Problem statement

Given an array of numbers, display an expression containing the elements in the array separated by the + symbol.

Example

input_array = [1, 2, 3, 4, 5]
result = 1+2+3+4+5

Try it yourself

Ruby
def make_expression(input_array)
result = ""
# Start your code here
return result
end