title: Is there any possible way to make @foo="" when if params[:query] was nil?
body: <p>When if params[:query] was nil, it gets error to display @messages in view.
  How can I set "" to @foo when if params[:query] was nil?</p>
  
  <pre><code>@foo = params[:query]
  @messages = 'I got this value' + @foo + 'etcs'
  </code></pre>
  
  <p>I want something like this</p>
  
  <blockquote>
    <p>@messages = 'I got this value' + (try(@foo) || "") + 'etcs'</p>
  </blockquote>