From: John Joyce Date: 2007-04-28T17:58:49+09:00 Subject: Re: ruby conditional operator ? : On Apr 28, 2007, at 5:51 PM, Yaxm Yaxm wrote: > Hi, > in java, I can use ? : shorthand operators to ensure s is assigned to > some value. > String s = s == null ? "" : s; > > Is there similar shorthand operator in Ruby? > > Thanks. > Yaxm > > -- > Posted via http://www.ruby-forum.com/. > The same old ternary operator is in Ruby as in most languages these days. ? : so... conditional_statement ? true_result : false_result