-
-
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
老師你好, 作業如連結, https://user-images.githubusercontent.com/44360489/47285585-053c4900-d61e-11e8-97cc-3dadf6212cf1.jpg
也看了 Scaffold 的 model/view/controller 的 code, 有比較之前了解, 特別是在 class/module 和 methods 的部份,
但是在 (1) Rails API (2) view .erb 和 .jbuilder 因為沒有前端的背景, 所以不了解 (3) symbol 的用法 似乎會被當作 method 像是
before_action :set_post, only: [:show, :edit, :update, :destroy], 這部份也不了解,下次上課再請教您,謝謝。
David