Skip to content

fixed ls code#6

Open
rani-i3 wants to merge 10 commits into
mainfrom
ranils
Open

fixed ls code#6
rani-i3 wants to merge 10 commits into
mainfrom
ranils

Conversation

@rani-i3

@rani-i3 rani-i3 commented Oct 17, 2023

Copy link
Copy Markdown
Owner

No description provided.

@JunichiIto JunichiIto left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントしました〜。

Comment thread 04.ls/ls1.rb
def print_files_in_columns(columns = 3)
file_list = list_files
max_length = file_list.map { |file| file.length }.max || 0
column_width = (max_length + 2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変数の寿命が長いので、もっと短くしましょう。
変数の寿命はできるだけ短くしよう | FBC

Comment thread 04.ls/ls1.rb
end

def print_files_in_columns(columns = 3)
file_list = list_files

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file_list = list_files
files = list_files
Suggested change
file_list = list_files
columns = Array.new(rows){[]}

「〜の配列」という名前を表現したいときは、複数形にすればOKです。(column_arraysも同様)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants