Skip to content

Instantly share code, notes, and snippets.

@blake41
Created July 25, 2013 23:06
Show Gist options
  • Save blake41/6084609 to your computer and use it in GitHub Desktop.
Save blake41/6084609 to your computer and use it in GitHub Desktop.
homework
def add_one(new_result)
new_result + 1
end
def arithmetic(number,another_number)
result = number+another_number
add_one(result)
end
arithmetic(5,6)
def food(add_food)
add_food + "cake"
end
def add_food(apple,banana)
new_food=apple+banana
food(new_food)
end
add_food("chocolate","snickers")
3 sets of 2 methods
1st method called add_one
it should take one argument and that argument should be an array
it should add the number one to the array
2nd method called start_me_up
it should take one argument and that argument should be an array
it should call the add_one method and pass it the argument received
call the start me up method with an array ["kirin", "blake"] [1,7]
1st method called is_it_greater_than_seven?
should take one argument and should return "higher than 7" or "lower than 7" if the argument it receives is == to 7
2nd method is called add_one
this method should take one argument
it should add_one to that argument and save as local variable
it should call is_it_greater_than_seven and pass it the local variable you created
1st method called is_array?
it will take one argument
if the argument is an array, return true, else return false
2nd method called pass_array
it will take 1 argument
it will call is_array and pass it that argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment