January 10 - Build a Dynamic Sum Method in Ruby
This coding exercise walks through how to build a method that takes a single integer as an argument and builds a sum of all of the integers counting up to the argument value.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Build a program that sums all of the integers up to, and including any value passed in as an argument.

Exercise Description

The program should be able to take in a single argument of an integer, and output the sum of all of the integers up to the argument's value.

Sample Input

10

Sample Output

55

Real World Usage

This is a common Ruby coding interview question. Additionally, being able to create dynamic ranges and perform calculations on the collection is important in a number of applications.

Test Cases

Code File