From: Jean Privat Date: Wed, 7 Oct 2015 17:53:39 +0000 (-0400) Subject: Merge: Multi iterators X-Git-Tag: v0.7.9~39 X-Git-Url: http://nitlanguage.org Merge: Multi iterators Introduce multi-iterators in `for`. A single `for` can now iterates over more than one collection at once. An iterator is used for each collection and the iteration is finished once the shortest iterator is finished. ~~~nit for i in [10, 20, 30], j in [1..10] do print i+j # outputs 11 22 33 ~~~ As expected by POLA, multi-iterators are also naturally usable on maps and comprehension arrays ~~~nit var m = new HashMap[Int,String] m[1] = "one" m[2] = "two" for k, v in m, i in [1..10] do print "{k}:{v}:{i}" # outputs 1:one:1 2:two:2 var a = [for i in [10, 20, 30], j in [1..10] do i + j] print a # outputs [11, 22, 33] ~~~ Close #1735 Pull-Request: #1748 Reviewed-by: Alexis Laferrière Reviewed-by: Lucas Bajolet --- 49c3a1a3bdc04451ff7295eb3fdf551b26301507