<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>A simple loop</title><link>https://community.appian.com/discussions/f/general/28236/a-simple-loop</link><description>I want to do something like this: 
 CONST MIN_YEAR = 15 
 int[] yearOptions 
 for int i = year(date)- MIN_YEAR to year(date)+1 { 
 yearOptions.push(i) 
 } 
 How can I do this in Appian? I suspect this need to be an expression rule and the number 15 may</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: A simple loop</title><link>https://community.appian.com/thread/110289?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2023 16:45:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:80319e84-a4ef-4637-9008-8b32c01ee3ce</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;LOL, That&amp;#39;s why I use Appian. It is just better than me in math ;-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A simple loop</title><link>https://community.appian.com/thread/110288?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2023 16:03:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cfd7478b-5bdf-4cbe-9af0-64910590c03c</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;Hey, you multiplied it by 5 there &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f62c.svg" title="Grimacing"&gt;&amp;#x1f62c;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A simple loop</title><link>https://community.appian.com/thread/110286?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2023 15:59:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:850f7300-ede3-4d1a-a00f-7d48bb7f741d</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;The Appian expression language follows a function paradigm. Variables are immutable. But just like Python, Appian can do some nifty magic on list types.&lt;/p&gt;
&lt;p&gt;Simple example: {1,2,3,4,5} * 5 = &lt;span style="text-decoration:line-through;"&gt;{3,6,9,12,15}&lt;/span&gt;&amp;nbsp; {5, 10, 15, 20, 25}&lt;/p&gt;
&lt;p&gt;Sanchit provided another example. Check out my blog for how to implement more complex algorithms.&amp;nbsp;&lt;a href="https://appian.rocks/2022/08/29/complex-algorithms-in-appian/"&gt;https://appian.rocks/2022/08/29/complex-algorithms-in-appian/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A simple loop</title><link>https://community.appian.com/thread/110276?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2023 14:49:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f3080735-a3a7-4f1d-bdb3-1516d5dd8532</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!years: 15,
  enumerate(local!years + 2) + year(today()) - local!years
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: A simple loop</title><link>https://community.appian.com/thread/110274?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2023 14:38:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b67b12d7-c5f4-4021-8dda-379db445bce3</guid><dc:creator>Alex Boerescu</dc:creator><description>&lt;p&gt;You could use a script like the one below. Save the output in another variable and change the format as you see fit.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!years: 15,
  {
    a!forEach(
      items: enumerate(local!years+2),
      expression: year(today()) - local!years + fv!item
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>