Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # NOTE: each following line was performed in sequence via irb.
- # test is an array
- >> test
- => ["a", "b", "a"]
- # this prints out the result of the count method
- >> test.count("a")
- => 2
- # BUT this does not! WHY? Is it some irb anomaly?
- >> test.each do |k|
- ?> test.count("a")
- >> end
- => ["a", "b", "a"]
- >> test.each do |k|
- ?> puts test.count("a")
- >> end
- 2
- 2
- 2
- => ["a", "b", "a"]
- >>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement