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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -