From: Jeremy Bopp Date: 2011-03-24T06:58:36+09:00 Subject: Re: Converting PHP to Ruby On 3/23/2011 15:52, Jack W. wrote: > If you'd like, here's an updated code with real variable names and some > comments. > > And one more question, how do I make one line statements in Ruby? I > would do like this in PHP. > > $animal = "cat"; > print $animal=="cat" ? "yes" : "no"; //Would print yes Equivalent from your example: animal = "cat" puts animal == "cat" ? "yes" : "no" /Really/ all 1 line: animal = "cat"; puts animal == "cat" ? "yes" : "no"