Created
April 28, 2025 14:58
-
-
Save Blarsamio/bce369c1a21028eec2fb759b81501396 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Define a method called 'calculate' | |
# 1a. this method takes 3 parameters, first_number, second_number and the operator | |
def calculate(first_number, second_number, operator) | |
# 2. Inside of this method, check which operation the user chose | |
case operator | |
when "+" then return first_number + second_number | |
when "-" then return first_number - second_number | |
when "*" then return first_number * second_number | |
when "/" then return first_number.to_f / second_number | |
else | |
return nil | |
end | |
# 3. Perform the correct calculation and then return the result | |
end | |
# # "helicopter" | |
# def method(parameter) | |
# # "helicopter" | |
# puts "This is a #{parameter}" | |
# end | |
# helicotper = "helicopter" | |
# method(helicotper) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment