mirror of
https://github.com/edgecase/ruby_koans.git
synced 2026-04-15 07:23:19 -04:00
Added bonus question about the file read.
This commit is contained in:
@@ -87,4 +87,17 @@ class AboutIteration < EdgeCase::Koan
|
|||||||
# map, select, etc.
|
# map, select, etc.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Bonus Question: In the previous koan, we saw the construct:
|
||||||
|
#
|
||||||
|
# File.open(filename) do |file|
|
||||||
|
# # code to read 'file'
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# Why did we do it that way instead of the following?
|
||||||
|
#
|
||||||
|
# file = File.open(filename)
|
||||||
|
# # code to read 'file'
|
||||||
|
#
|
||||||
|
# When you get to the "AboutSandwichCode" koan, recheck your answer.
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user