.......
...........
1.upto(n){
  str = gets.chomp
  
  if str.length > max
    max = str.length
    maxstr = str
  
  elsif str.length = max 
    if str > maxstr
      maxstr = str
    end
      
    end
    }
...........

this piece of code is giving me an error in the elsif line saying that
[undefined method `length=' for "word i enter" String (NoMethodError)]


any help regarding the problem wud be greatly appreciated

Use == to compare values; = performs assignment, not comparison.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.