In this guide you’ll learn how to find divisible numbers by leveraging Ruby’s detect method.
Summary
Build a method that finds the first divisible number of two integers.
Exercise File
Exercise Description
Given two integers, build a method that returns the first number that is divisible by both numbers.
Sample Input
Given the numbers:
12, 16
Expected Output
48
Real World Usage
Finding divisible numbers is a common coding interview question. Additionally, it’s an important concept when working with mathematical equations.
Solution
Can be found on the solutions branch on github.
TypeError:
false can’t be coerced into Fixnum