sum.push(100)
sum.push(",")
sum.push(200)
allsum = sum.split(",")
while i < 2
    totalsum = totalsum + allsum[i]
    i = i+ 1
end
for this i am getting the error as Array can't be coerced i开发者_如何学JAVAnto Fixnum in ruby on rails can anybody help me on this
sum = [100, ",", 200]
i = 0
totalsum = 0
for i in 0..sum.length-1 do
  if sum[i].kind_of? Integer
    totalsum = totalsum + sum[i]
  end
end
puts totalsum
I am not sure about the Rails way. But is one of the solution using Ruby.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论