S
Sijo Kg
Hi
I have
def get_company_details_array
c = nil
arr = [] if c.nil?
c.nil? ? 2.times {arr.push("")} :['a','b']
end
arr = ['abc'] + get_company_details_array
puts arr.inspect
What I expected here is ["abc","",""] But I am getting error
array.rb:7:in `+': can't convert Fixnum into Array (TypeError)
from array.rb:7
Could anybody please correct the code?
Thanks in advance
Sijo
I have
def get_company_details_array
c = nil
arr = [] if c.nil?
c.nil? ? 2.times {arr.push("")} :['a','b']
end
arr = ['abc'] + get_company_details_array
puts arr.inspect
What I expected here is ["abc","",""] But I am getting error
array.rb:7:in `+': can't convert Fixnum into Array (TypeError)
from array.rb:7
Could anybody please correct the code?
Thanks in advance
Sijo