enumerate(): count from 1 to n
Easy
Return the whole numbers from 1 to ri!n. For 5 that is {1, 2, 3, 4, 5}.
enumerate() starts at 0, so its numbers are each one short. You do not need a loop to correct them.
Input
ri!n— Integer
ri! Rule Inputs
ri!nInteger5
Example 1 — Five numbers
Input: ri!n
5
Output:
{
1,
2,
3,
4,
5
}Example 2 — Just one
Input: ri!n
1
Output:
{1}Example 3 — None at all
Input: ri!n
0
Output:
{}Example 4 — Ten
Input: ri!n
10
Output:
{
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
}Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter