From: "Peña, Botp" Date: 2008-06-17T09:59:23+09:00 Subject: Re: Question about Ruby syntax From: fedzor [mailto:fedzor@gmail.com] # On Jun 16, 2008, at 8:15 PM, Chance Dinkins wrote: # > def parse_Requests(requests) # > output = Array.new # > requests.each{|item| # > if(FileTest.exist?(item)) # Starts an if # > if FileTest.directory?(item)?output << parse_Dir(item) : # > output << # > parse_File(item) # Starts an If # > else # > output << parse_error(item) # > end # Ends an if # > } # > end # # with this line here: # > if FileTest.directory?(item)?output << parse_Dir(item) : # > output << # > parse_File(item) # # You are trying to do a ternary operator. however, you are # starting it # with an if! # Try this: # # FileTest.directory?(item) ? output << parse_Dir(item) : output << # parse_File(item) also the chevrons are leading to the output, so, output << if(FileTest.exist?(item)) FileTest.directory?(item) ? parse_Dir(item) : parse_File(item) else parse_error(item) end kind regards -botp