Hi Everyone,

I am a Ruby newer. This is my "Ruby Blocks and Closures" homework exercise
code. If you have time ,please review it. Please give me some
suggestions.Thank you!



# To change this template, choose Tools | Templates
# and open the template in the editor.

class MyOwnRubyClass
  def my_own_ruby_method(my_parameter, your_parameter)
    puts Time.now
    current_month = Time.now.month
    yield(my_parameter, your_parameter, current_month)
  end
end

my_instance = MyOwnRubyClass.new
my_instance.my_own_ruby_method("Zhang", "Phoenix") do |i, j ,k|
  1.upto(k) do |x|
    print x
    puts " " + i.reverse + ", " + j.reverse
  end
end

my_instance.my_own_ruby_method("Zhang", "Phoenix") do |i, j, k|
  1.upto(k) do |x|
    print x
    puts " " + "first value = " + i.length.to_s + ", second value = " +
j.length.to_s + ", addition value = " + (i.length + j.length).to_s
  end
end



Best Regards,
Phoenix

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to