List Rb wrote:
> Because puts("hi") yields nil, the second item never gets called:
>     puts "hi" and puts "bye" if true

I guess what you're trying to compress is this:

  if true
    puts "hi"
    puts "bye"
  end

If you really want a one-liner, then your best option is probably

  (puts "hi"; puts "bye") if true

(The parentheses ARE needed here. Otherwise puts "hi" is run always)

If these are actually both calls to puts then you only need a single 
one:

   puts "hi","bye" if true

Everything else gets yucky. For example, you can rely on the nil return 
value of puts:

  puts "hi" or puts "bye" if true

  puts("hi") || puts("bye") if true
-- 
Posted via http://www.ruby-forum.com/.