[Ruby] unless block on one line
shaners becker
veganstraightedge at gmail.com
Fri Jan 26 14:55:50 PST 2007
thanks. it seems like i always get these syntax questions super late
at night when i should be sleeping but am coding instead.
thanks again.
shaners
On Jan 26, 2007, at 6:35 AM, Andrew Stewart wrote:
>
>> is there a way of expressing this on one line?
>>
>> unless row.at(7).nil?
>> this_row[:print_date] = row.at(7).date
>> end
>
> You were close! This is what you need to do:
>
> this_row[:print_date] = row.at(7).date unless row.at(7).nil?
>
> Regards,
> Andy Stewart
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
-----------
join the resistance. fall in love.
http://theresistancearmy.com/
More information about the Ruby
mailing list