Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created March 3, 2017 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/8c81d7513132f7ed9491ea49e7de5e26 to your computer and use it in GitHub Desktop.
Save hyuki0000/8c81d7513132f7ed9491ea49e7de5e26 to your computer and use it in GitHub Desktop.
#Rubyの問題 テキストの各行に何文字あるかを調べるRubyスクリプト、あなたならどう書きますか。
open "file.txt" do |f|
while !f.eof? do
l = f.readline
break unless l
puts "#{l.length}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment