MOFM2T 1.1 RTF Avatar
  1. OMG Issue

MOFM2T11 — Provide a way for users to get the iteration count in a for loop

  • Key: MOFM2T11-9
  • Legacy Issue Number: 14557
  • Status: open  
  • Source: Obeo ( Laurent Goubet)
  • Summary:

    MTL Currently specifies a "for-each" kind of loop, with no possibility for the user to know the index of the current iteration in the list of values they're iterating over.

    It would be nice to have access to an implicit variable within for loops to get this index. Something like

    [for (value : String | Sequence

    {'a', 'b', 'c'}

    )/]
    [i/] = [value/]
    [/for]

    would then generate text :

    1 = a
    2 = b
    3 = c

    I named this implicit variable "i" in this example, it could be named "iterationCount" or "iterationIndex" if we want to avoid conflicts... Yet I'd rather it be named "i" myself.

  • Reported: MOFM2T 1.0 — Tue, 13 Oct 2009 04:00 GMT
  • Updated: Fri, 6 Mar 2015 20:58 GMT