====== find ====== ===== Description ===== //pred//がtrueを返す要素を見つけるまでイテレートし、見つけたらその要素を返し、見つからなければundefinedを返します。 ===== Example ===== ランキングっぽい処理をするサンプルです。 ==== C++ ==== ==== Xtal ==== ranking : [ [1000, "foo", "15:23:33"], [800, "bar", "15:25:08"], [750, "piyo", "08:22:45"], [0, "", "--:--:--"], [0, "", "--:--:--"] ]; ranking.p; newScore : 790; newName : "hoge"; newTime : "15:46:10"; i, it : ranking.with_index.find(|i, x| x[0] ==== Output ==== [[1000, foo, 15:23:33], [800, bar, 15:25:08], [750, piyo, 08:22:45], [0, , --:--:--], [0, , --:--:--]] rank in!(rank 3) [[1000, foo, 15:23:33], [800, bar, 15:25:08], [790, hoge, 15:46:10], [750, piyo, 08:22:45], [0, , --:--:--]]