Exercise 3: Convert Miles to Kilometers
Explore how to define a Ruby method named miles_to_kilometers that takes a distance in miles and converts it to kilometers. Learn to create and use simple methods, handle input values, and return results accurately.
We'll cover the following...
We'll cover the following...
Problem statement
Write a method named miles_to_kilometers that inputs a number, in this case, distance covered in miles, and converts it into distance covered in kilometers.
Example
miles_to_kilometers(25)
This should print out:
40.2335
Note: You just need to provide the definition of the method, and it will be automatically evaluated on the given input value.