-
-
Save kaochenlong/121905946c17c94e671c7edda3e4e68f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 練習:請印出從 1 到 100 之間所有的單數。 | |
# 練習:請印出從 1 到 100 之間所有的單數的總和。 | |
# 練習:改良版土砲 times 方法 | |
5.my_times { |i| puts i } # 印出數字 0 ~ 4 | |
# 練習:土砲 select 方法 | |
[1, 2, 3, 4, 5].my_select { |i| i.odd? } # 只印出單數 1, 3, 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ruby on Rails Practice Week 2,麻煩龍哥了。