Skip to content

Instantly share code, notes, and snippets.

@ruxandrafed
Forked from davidvandusen/renter.rb
Last active September 2, 2015 01:07
Show Gist options
  • Save ruxandrafed/578989d30bc596fc04e2 to your computer and use it in GitHub Desktop.
Save ruxandrafed/578989d30bc596fc04e2 to your computer and use it in GitHub Desktop.
# must be baller and either furnished or rent cheaper than 2100
def rent?(furnished, rent, baller)
result = baller && (furnished || rent < 2100)
puts "Furnished: #{furnished}. Rent: #{rent}. Baller: #{baller}. Rent? #{result}"
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.
###
puts rent?(true, 1000, false) #false
puts rent?(true, 1000, true) #true
puts rent?(true, 3000, false) #false
puts rent?(true, 3000, true) #true
puts rent?(false, 1000, false) #false
puts rent?(false, 1000, true) #true
puts rent?(false, 3000, false) #false
puts rent?(false, 3000, true) #false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment