I was trying to do something like this but i don’t know much about this language:
def teste (*array1, *array2)
Is this possible to do? I have to pass one array of numbers and strings and one only of strings but i dont know how much elements each one has.
It doesn’t matter how many elements both of your array arguments have. For your purpose you can do just this:
def teste(arr_of_strings_and_numbers, arr_of_only_strings)Now call the method like this:
teste( [1, 2, 3, 'foo', 'bar'], ['foo', 'bar', 'baz'] )In your method body you have now access to:
arr_of_strings_and_numberswhich equals[1, 2, 3, 'foo', 'bar']and
arr_of_only_stringswhich equals['foo', 'bar', 'baz']