-
-
Save gbrl/57a79cdfd1ee2540c16470de0f4058cb to your computer and use it in GitHub Desktop.
This file contains 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
# must be baller and either furnished or rent cheaper than 2100 | |
def rent?(furnished, rent, baller) | |
puts "Furnished is #{furnished}, rent is #{rent}, baller status is #{baller}" | |
if baller && (furnished || rent < 2100) | |
puts "Yeah, let's do it. \n" | |
return true | |
else | |
puts "Nah, I don't want it. \n" | |
return false | |
end | |
end | |
### | |
# Add your "test" ("driver") code below in order to "test drive" (run) your method above... | |
# The test code will call the method with different permutations of options and output the result each time. | |
# This way, you will be able to run the renter.rb file from the CLI and look at the output of your "tests" to validate if the method works. | |
# Without the test code, it will be hard for you to know if this method is working as it should or not. | |
### | |
furnished_values = [true,false] | |
rent_values = [3000,1000] | |
baller_values = [true,false] | |
baller_values.each do |baller_value| | |
furnished_values.each do |furnished_value| | |
rent_values.each do |rent_value| | |
rent?(furnished_value,rent_value,baller_value) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment