From: Dylan Evans Date: 2009-02-19T12:04:06+09:00 Subject: Re: Dynamic string (depending on a variable) --000e0cd1a5c2bbc7e904633cca72 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit sentence = "Your ticket expired " + (nb_of_days>0? nb_of_days.to_s + " days ago." : "today.") On Thu, Feb 19, 2009 at 10:39 AM, Guillaume Loader wrote: > Hello everyone! > > Do you have a better way to do this ? > > sentence = "Your ticket has expired since #{nb_of_days if nb_of_days<0} > #{'days' if nb_of_days<0} #{'today' if nb_of_days==0}" > > My goal is to print something like this : "Your ticket has expired since > 4 days" or "Your ticket has expired since today" > > > I've tried this : > > sentence = "Your ticket has expired since #{nb_of_days + 'days' if > nb_of_days<0} #{'today' if nb_of_days==0}" > > But it doesn't work! > > Thank you for your help :) > -- > Posted via http://www.ruby-forum.com/. > > -- The UNIX system has a command, nice ... in order to be nice to the other users. Nobody ever uses it." - Andrew S. Tanenbaum --000e0cd1a5c2bbc7e904633cca72--