Skip to content

Special Operators

Betty provides special operators for handling ranges and list indexing efficiently.

Feature Syntax Description Example Usage
Range [start..end] Defines a range of values starting from start, incrementing by 1, and stopping before end. Internally calls range() function. [1..4][1, 2, 3]
List Indexing listvar[indexer] Accesses elements within a list using an index, which can be a number, variable, or function call. a = [1, 2, 3]; print(a[0]);1