Hi,

Am Freitag, 10. Jul 2009, 11:25:58 +0900 schrieb Jorden Gershenson:
> class Dragon
> 
>   boyg=rand(2)
>   if boyg==0
>     @gender='boy'
>     @gen='him'
>   end
>   if boyg==1
>     @gender='girl'
>     @gen='her'
>   end
> 
>   puts 'Gongratulations, you are now the parent of a beautiful baby ' @gender + ' dragon!'
>   puts 'What will you name ' + @gen + '?'
> 
> end

Just some ideas for fun:

  class Dragon
    GENDERS = { :boy => "him", :girl => "her" }
    @gender = [ :boy, :girl][ (rand 2)]
    @gen = GENDERS[ @gender]
    puts <<-EOT
Gongratulations, you are now the parent of a beautiful baby #@gender dragon!
What will you name #@gen?
    EOT
  end

Nice what Ruby can turn to, isn't it?

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de