Mwnci range() Function

Syntax

range(start, stop, step)

Description

The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.

Example

println(range(5))

[0,1,2,3,4]


println(range(2,6))

[2,3,4,5]


println(range(1,10,2))

[1, 3, 5, 7, 9]


range(100,0,-2)

[100, 98, 96, 94, 92, 90, 88, 86, 84, 82, 80, 78, 76, 74, 72, 70, 68, 66, 64, 62, 60, 58, 56, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]