Generate a Descending Number Sequence
Easy
Given an integer n, write an Appian expression that generates and returns a list of integers starting from n and decreasing by 1 until 1.
Example :
Input:
n = 5
Output:
{5, 4, 3, 2, 1}
ri! Rule Inputs
ri!nNumber (Integer)5
Example 1 — Case 1
Input: ri!n
5
Output:
{
5,
4,
3,
2,
1
}Example 2 — Case 2
Input: ri!n
9
Output:
{
9,
8,
7,
6,
5,
4,
3,
2,
1
}Example 3 — Case 3
Input: ri!n
13
Output:
{
13,
12,
11,
10,
9,
8,
7,
6,
5,
4,
3,
2,
1
}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