{"url":"https://obelisk.hatenablog.com/entry/2017/03/06/232710","title":"Python \u306e for else \u3063\u3066\u5730\u5473\u306b\u4fbf\u5229\u3068 Rubyist \u304c\u601d\u3046","height":"190","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2017%2F03%2F06%2F232710\" title=\"Python \u306e for else \u3063\u3066\u5730\u5473\u306b\u4fbf\u5229\u3068 Rubyist \u304c\u601d\u3046 - Camera Obscura\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","author_url":"https://blog.hatena.ne.jp/obelisk2/","description":"\u306e\u3067\u3001\u904a\u3073\u3067 Ruby \u3067\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002each_with_proc(pc, *args) \u3067\u3001\u3075\u3064\u3046\u306e each \u306e\u30eb\u30fc\u30d7\u304c\u7d42\u3063\u305f\u3042\u3068\u306b proc \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 pc \u304c pc.call(*args) \u3055\u308c\u307e\u3059\u3002\u30d6\u30ed\u30c3\u30af\u304b\u3089 break \u3067\u629c\u3051\u305f\u5834\u5408\u306f proc \u306f\u547c\u3070\u308c\u307e\u305b\u3093\u3002 module Enumerable def each_with_proc(pc, *args) each {|i| yield(i)} pc.call(*args) end end ar = [] 4.times {ar << rand(10)} pc = proc {puts \"Nyao, hit!\"} ar\u2026","blog_title":"Camera Obscura","categories":["Ruby","Python"],"blog_url":"https://obelisk.hatenablog.com/","provider_name":"Hatena Blog","author_name":"obelisk2","image_url":null,"provider_url":"https://hatena.blog","width":"100%","published":"2017-03-06 23:27:10","type":"rich"}