Skip to content

Instantly share code, notes, and snippets.

@Andsbf
Created March 4, 2015 00:30
Show Gist options
  • Save Andsbf/25059439fbb7ded780cf to your computer and use it in GitHub Desktop.
Save Andsbf/25059439fbb7ded780cf to your computer and use it in GitHub Desktop.
The Yuppie Vancouverite Exercise
# must be baller and either furnished or rent cheaper than 2100
def rent?(furnished, baller, rent)
baller && (furnished || rent < 2100)
# if baller && (furnished || rent < 2100)
# return puts true
# else
# return puts false
# end
end
def check_rent (furnished, baller, rent)
puts (rent?(furnished, baller, rent) ? "rent" : "not rent")
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.
###
check_rent(true,true,10000)
check_rent(true,true,10)
check_rent(true,false,10000)
check_rent(true,false,10)
check_rent(false,true,10000)
check_rent(false,false,1000)
check_rent(false,true,10)
check_rent(false,false,10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment