Skip to content
Simon East edited this page Mar 22, 2019 · 6 revisions

The range command can help us to generate number ranges.

Syntax

range START END STEP PADDING

Arguments

  • START (required) the starting number for this number range
  • END (optional) the last number of this number range. This value will be included in the list.
  • STEP (optional) the value to add to START for each selection. The default is 1.
  • PADDING (optional) the padding of the number. Leading zeroes will be added if the number of digits are smaller then this value. The default is 1.

All arguments can be negative as well.

Generate a number range for multiple selections:

We have three selections like in this setup:

<p>|</p>
<p>|</p>
<p>|</p>

Now, let's open the text pastry command line and enter this command:

range 5 10

We will get this result:

<p>5</p>
<p>6</p>
<p>7</p>

Generate numbers

The range command will behave differently when we have a single selection. To generate numbers, we make sure that we have only one selection:

# Numbers from 27 to 62
|

Now we can open the Text Pastry command line and enter this command:

range 27 62

We will get this result:

# Numbers from 27 to 62
27
28
29
...
60
61
62

Padding and step size

The third argument defines the step size. Leading zeroes can be applied to the numbers as well:

range 90 100 5 3

will produce this list:

090
095
100

Repeating numbers

If you need to repeat numbers a certain number of times, you can append each=X to the end of the command. For example:

range 1 3 each=2

will produce:

1
1
2
2
3
3