Created
March 3, 2017 00:43
-
-
Save hyuki0000/8c81d7513132f7ed9491ea49e7de5e26 to your computer and use it in GitHub Desktop.
#Rubyの問題 テキストの各行に何文字あるかを調べるRubyスクリプト、あなたならどう書きますか。
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
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