Ruby `Array#delete` -
i defining method takes 2 arguments (an array , string) , deletes string array.
here have far:
def using_delete(instructors, x = "steven") instructors = ["josh", "steven", "sophie", "steven", "amanda", "steven"] instructors.delete ("steven") instructors end
a test requiring instances of "steven"
deleted not passing.
you need move instructors
assignment outside of method, otherwise there's no point in allowing argument. also, delete using x
argument instead of hardcoding value:
instructors = ["josh", "steven", "sophie", "steven", "amanda", "steven"] def using_delete(instructors, x="steven") instructors.delete x instructors end
Comments
Post a Comment