<commit_before># Concatenate Two Arrays

# I worked on this challenge [by myself].


# Your Solution Below

=begin ======PSEUDOCODE 1======

INPUT: two arrays
OUTPUT: single array composed of the two input arrays

create a an empty array called OUTPUT

IF the first array is empty and the second array is empty
  return OUTPUT
ELSE
  FOR EACH element in the second array DO this
    APPEND each element of second array to end of OUTPUT array
  END the loop
  return the OUTPUT

=end #======PSEUDOCODE 1======


=begin ======Initial Solution======

def array_concat(array_1, array_2)
  output = array_1

  if array_1 == [] && array_2 == []
    return output
  else
    array_2.each do |value|
      return output << value
    end
  end
end

=end  #======Initial Solution======

#=begin ======Refactored Solution======

def array_concat(array_1, array_2)
  if array_1 == [] && array_2 == []
    return array_1
  else
    array_1.concat(array_2)
    return array_1
  end
end


#=end #======Refactored Solution======<commit_msg>Improve refactored solution<commit_after># Concatenate Two Arrays

# I worked on this challenge [by myself].


# Your Solution Below

=begin ======PSEUDOCODE 1======

INPUT: two arrays
OUTPUT: single array composed of the two input arrays

create a an empty array called OUTPUT

IF the first array is empty and the second array is empty
  return OUTPUT
ELSE
  FOR EACH element in the second array DO this
    APPEND each element of second array to end of OUTPUT array
  END the loop
  return the OUTPUT

=end #======PSEUDOCODE 1======


#=begin ======Initial Solution======

def array_concat(array_1, array_2)
  output = array_1

  if array_1 == [] && array_2 == []
    return output
  else
    array_2.each do |value|
      return output << value
    end
  end
end

#=end  #======Initial Solution======

#=begin ======Refactored Solution======

def array_concat(array_1, array_2)
  if array_1 == [] && array_2 == []
    return array_1
  else
    return array_1.concat(array_2)
  end
end

#=end #======Refactored Solution======
{'fraction_non_alphanumeric': 0.12676743052169673, 'fraction_numerical': 0.015114578254509995, 'mean_word_length': 3.7832167832167833, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3941122', 'n_tokens_mistral': 679, 'n_tokens_neox': 644, 'n_words': 252}