#!/usr/local/bin/ruby
class Greeter
  attr_accessor :name
  def initialize(name = "world")
    @name = name
  end
  def say_hi
    if @name.nil?
      puts "..."
    elsif @name.respond_to?("each")
      @name.each |name|
        puts "Hi, #{name.capitalize}
      end
    else
      puts "Bye, #{@name}
    end
  end
  def say_bye
    puts "Bye, #{@name}"
  end
end

if __FILE__ == $0
  g1 = Greeter.new
  g1.say_hi
  g1.say_bye
  g2 = Greeter.new("django")
  g2.say_hi()
  g2.say_bye()
  printf "%s ", g2.respond_to?("name")
  puts g2.respond_to?("name=")
  puts g2.name
  g2.name = "lily"
  g2.say_hi
  g2.say_bye
  puts if 3 == 2 333 else 222
end