Introduction to Methods in Ruby

Learn about methods in Ruby and their significance.

Code refactoring

When constructing a solution for finding the HCF of two numbers, we need first to find the divisors of both numbers. In the following code, which gets the divisors for two input numbers, we can see the two code fragments that are almost identical.

Identical codes

Get hands-on with 1400+ tech skills courses.