<commit_before># You'll get a string and a boolean.
# When the boolean is true, return a new string containing all the odd characters.
# When the boolean is false, return a new string containing all the even characters.
#
# If you have no idea where to begin, remember to check out the cheatsheets for string and logic/control
#

def odds_and_evens(string, return_odds)
  to_return = ""
  string.length.times do |index|
    next if return_odds && index.even?
    next if !return_odds && index.odd?
    to_return << string[index]
  end
  to_return
end

puts odds_and_evens("abcdefghi", true)

def odds_and_even(string, return_odds)
	var = string.split(//)
	if !return_odds
		var.values_at(* var.each_index.select {|i| i.even?})
	else
		var.values_at(* var.each_index.select {|i| i.odd?})
	end
end

puts odds_and_even("abcdefghi", true)<commit_msg>Update challenge 6<commit_after># You'll get a string and a boolean.
# When the boolean is true, return a new string containing all the odd characters.
# When the boolean is false, return a new string containing all the even characters.
#
# If you have no idea where to begin, remember to check out the cheatsheets for string and logic/control
#

def odds_and_evens(string, return_odds)
  to_return = ""
  string.length.times do |index|
    next if return_odds && index.even?
    next if !return_odds && index.odd?
    to_return << string[index]
  end
  to_return
end

puts odds_and_evens("abcdefghi", true)

def odds_and_even(string, return_odds)
	var = string.split(//)
	if !return_odds
		var1 = var.values_at(* var.each_index.select {|i| i.even?})
	else
		var1 = var.values_at(* var.each_index.select {|i| i.odd?})
    var1.join
  end
end

puts odds_and_even("abcdefghi", true)
{'fraction_non_alphanumeric': 0.09907300115874855, 'fraction_numerical': 0.002317497103128621, 'mean_word_length': 4.201807228915663, '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': '1986217', 'n_tokens_mistral': 604, 'n_tokens_neox': 583, 'n_words': 200}