From: jbw Date: 2010-03-31T10:05:29+09:00 Subject: Re: why getting error for this code fragment Are you trying to use unary if operations? If so you need to add ':' like so (runtime==nil ? 'nil' : :runtime) On Wed, Mar 31, 2010 at 1:27 AM, Amishera Amishera wrote: >  5 class Movie_Info >  6         attr_accessor :runtime, :language, :sound, :color >  7         def to_str >  38                 puts > (runtime==nil?'nil':runtime)+'&&&'+(language==nil?'nil':language)+'&&&'+(color==nil?'nil':color)+'&&&'+(sound==nil?'nil':sound) >  39                 return str >  40         end >  41 end > > the statement at line 38 causes some error. > > ./util.rb:38: syntax error, unexpected tSTRING_BEG, expecting kDO or '{' > or '(' (SyntaxError) >                puts > (runtime==nil?'nil':runtime)+'&&&'+(language==nil?'nil':language)+'&&&'+(color==nil?'nil':color)+'&&&'+(sound==nil?'nil':sound) > -- > Posted via http://www.ruby-forum.com/. > > -- jbw