Types and Data Structures¶
RuLA supports four fundamental types for working with data:
| Type | Description | Example |
|---|---|---|
| String | Text values | "Hello World" |
| Number | Numeric values (integers and decimals) | 42, 3.14 |
| List | Ordered collections of values | ['a', 'b', 'c'] |
| Dictionary | Key-value pairs | {'name': 'John', 'age': 30} |
Each type has its own syntax for creation, specific operators for manipulation, and built-in functions for common operations.
Quick Reference¶
Creating Values¶
"This is a string" # String
42 # Number
3.14159 # Number
['apple', 'banana'] # List
{'x': 1, 'y': 2} # Dictionary
Common Operations¶
| Operation | Strings | Numbers | Lists | Dictionaries |
|---|---|---|---|---|
| Length | LEN |
- | COUNT |
COUNT |
| Check if empty | LEN(text) == 0 |
- | list == [] |
dict == {} |
| Access by index/key | text[index] |
- | list[index] |
dict[key] |
| Check containment | text contains "x" |
- | contains |
in |