Skip to content

Instantly share code, notes, and snippets.

@kaochenlong
Last active July 5, 2016 03:09
Show Gist options
  • Save kaochenlong/fa107239cc5178753dcbdd390e47d062 to your computer and use it in GitHub Desktop.
Save kaochenlong/fa107239cc5178753dcbdd390e47d062 to your computer and use it in GitHub Desktop.
5.my_times do |i|
puts "#{i} hello"
end
# 或
my_times(5) do |i|
puts "#{i} hello"
end
# 期望結果:
# 1 hello
# 2 hello
# 3 hello
# 4 hello
# 5 hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment