Hi guys I am doing this codewar challenge.
The goal is to implement data structure manipulation for method prefill(n, v).
def prefill(n, v)
some code
end
One of the requirements is to give a default "undefined" value for the method argument v if it's not given when method is called.
I am not sure how I can catch this ArgumentError and re-trigger the iteration of prefill. Can someone help?
You don't need to, you need to use default arguments, like this:
def prefill(n, v = nil)
# code
end