session3/challenge/6_arguments.rb
# Write a method, match_maker, which will receive an unknown number of
# elements, and return an array where every two elements are represented by true or false.
#
# The very first parameter will not be part of this set. Instead, it will tell
# you how to determine what their value should be.
# If it is true, then they will be true when they are oppositely truthy.
# If it is false, then they will be true when they are similarly truthy.
#
# Examples:
# match_maker false, true,  true                # => [true]
# match_maker true,  true,  true                # => [false]
# match_maker true,  false, false               # => [false]
# match_maker true,  false, true                # => [true]
# match_maker true,  true,  false               # => [true]
# match_maker true,  true,  true, false, true   # => [false, true]
# match_maker true,  true,  true, false, nil    # => [false, false]
# match_maker true,  true,  true, true, nil     # => [false, true]
# match_maker true,  true,  true, 0, nil        # => [false, true]
Write a method, match_maker, which will receive an unknown number of
elements, and return an array where every two elements are represented by true or false.

The very first parameter will not be part of this set. Instead, it will tell
you how to determine what their value should be.
If it is true, then they will be true when they are oppositely truthy.
If it is false, then they will be true when they are similarly truthy.


Write a method match_maker which will receive an unknown number of elements and return an array where every two elements are represented by true or false . The very first parameter will not be part of this set . Instead it will tell you how to determine what their value should be . If it is true then they will be true when they are oppositely truthy . If it is false then they will be true when they are similarly truthy .
def match_maker(*args)
  ary = []
  args.each_with_index { |v, i| !!v == !!args[i + 1] ? ary << false : ary << true if i.odd? }
  args[0] ? ary : ary.map { |e| !e }
end
def match_maker ( * args ) ary = [ ] args . each_with_index { | v , i | ! ! v == ! ! args [ i + 1 ] ? ary << false : ary << true if i . odd? } args [ 0 ] ? ary : ary . map { | e | ! e } end
Write a method, match_maker, which will receive an unknown number of
elements, and return an array where every two elements are represented by true or false.
Write a method match_maker which will receive an unknown number of elements and return an array where every two elements are represented by true or false .
args
<not_specific>