Difference between revisions of "Range"

From MiniScript Wiki
Jump to navigation Jump to search
(Format parameters)
Line 1: Line 1:
<c>range</c> returns a list containing a series of numbers within a range.
+
<c>range(from, to, step)</c> returns a list containing a series of numbers within a range.
from (number, default 0): first number to include in the list
+
 
to (number, default 0): point at which to stop adding numbers to the list
+
* <c>from</c> (number, default 0): first number to include in the list
step (number, optional): amount to add to the previous number on each step; defaults to 1 if to > from, or -1 if to < from
+
* <c>to</c> (number, default 0): point at which to stop adding numbers to the list
 +
* <c>step</c> (number, optional): amount to add to the previous number on each step; defaults to 1 if to > from, or -1 if to < from
  
 
== Example ==
 
== Example ==

Revision as of 23:34, 5 December 2021

range(from, to, step) returns a list containing a series of numbers within a range.

  • from (number, default 0): first number to include in the list
  • to (number, default 0): point at which to stop adding numbers to the list
  • step (number, optional): amount to add to the previous number on each step; defaults to 1 if to > from, or -1 if to < from

Example

range(50, 5, -10)		// returns [50, 40, 30, 20, 10]