Skip to content

Instantly share code, notes, and snippets.

@CheezItMan
Last active September 4, 2020 15:17
Show Gist options
  • Save CheezItMan/bcb24385b1fd93c22c24636a9cf9cb5b to your computer and use it in GitHub Desktop.
Save CheezItMan/bcb24385b1fd93c22c24636a9cf9cb5b to your computer and use it in GitHub Desktop.
# Review the code below
# What questions do you have?
# What happens if the commented lines
# are uncommented?
MY_EARNINGS = 10
def sales_tax(amount)
# puts "tax = #{tax}"
# puts "amount = #{amount}"
puts "MY_Earnings is #{MY_EARNINGS}"
tax = amount * 0.08
return tax
end
# puts tax
my_tax = sales_tax(MY_EARNINGS)
puts "My Sales tax is #{my_tax}"
# Identify:
# 1. Method Signature
# 2. Constant
# 3. Parameter
# 4. Argument
# 5. return value
# 6. Method body
# 7. Where do we invoke the method
# 8. What is the scope of "tax"
# 9. What will this return:
# true || false && true
# (3 + 7) ** 2 > 9 * 9
# 10. Explain the difference between
# until loops and while loops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment