Ruby - Methods - Variable Arguments

  • + 0 comments

    Solution 1:

    def full_name(*str)
        str.inject { |a, b| a + ' ' + b }
    end
    

    Solution 2:

    def full_name(*str)
        str.join(' ')
    end