From: "matz (Yukihiro Matsumoto)" Date: 2012-03-31T00:28:01+09:00 Subject: [ruby-core:43944] [ruby-trunk - Feature #6073] Proposal of extending syntax of for loop Issue #6073 has been updated by matz (Yukihiro Matsumoto). The current for statement does not do any map-like work. Under such behavior, extending for statement might not have enough benefit worth adding complexity. So, I have to reject this proposal for now. Matz.l ---------------------------------------- Feature #6073: Proposal of extending syntax of for loop https://bugs.ruby-lang.org/issues/6073#change-25470 Author: shouichi (Shouichi KAMIYA) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: Hi, I propose to extend syntax of for loop which allows us to write multiple loop with guard easily. This extension is inspired by Scala. Here is a example for i in 1..4 when i % 2 == 0 j in 5..8 when j % 4 == 0 puts "#{i}, #{j}" end Above code is same as following code. for i in 1..4 if i % 2 == 0 for j in 5..8 if j % 4 == 0 puts "#{i}, #{j}" end end end end I already implemented this syntax and attached a patch. What do you think about this syntax guys? Thank you, Shouichi -- http://bugs.ruby-lang.org/