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 -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -