4/5

enumerate(): count down to a launch

Medium

A launch screen counts down from ri!from to 1 and then shows "Go!". Return every label as text: from 3 that is {"3", "2", "1", "Go!"}.

enumerate() only ever counts up from 0, so the descending numbers have to be worked out from it. Every label is text, the numbers included: a list that mixes numbers with "Go!" is not the same answer.

Input

  • ri!from — Integer

ri! Rule Inputs

ri!fromInteger
5

Example 1 — From three

Input: ri!from
3
Output:
{
  "3",
  "2",
  "1",
  "Go!"
}

Example 2 — From one

Input: ri!from
1
Output:
{
  "1",
  "Go!"
}

Example 3 — From five

Input: ri!from
5
Output:
{
  "5",
  "4",
  "3",
  "2",
  "1",
  "Go!"
}

Example 4 — Nothing to count

Input: ri!from
0
Output:
{"Go!"}

Appian Expression Tips

  • • Use ri!variableName for 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