Ruby-Pair/main.rb
#count method, returns the number of items in the top level of the list if the pair is a list, else returns false
count method, returns the number of items in the top level of the list if the pair is a list, else returns false
count method returns the number of items in the top level of the list if the pair is a list else returns false
def count
    if pair?
      if @value2.pair?
        countsofar = @value2.count
        1 + countsofar
      elsif @value2.nil?
        1
      else
        2
      end
    elsif nil?
      0
    else
      1
    end
  end
def count if pair? if @value2 . pair? countsofar = @value2 . count 1 + countsofar elsif @value2 . nil? 1 else 2 end elsif nil? 0 else 1 end end
count method, returns the number of items in the top level of the list if the pair is a list, else returns false
count method returns the number of items in the top level of the list if the pair is a list else returns false