

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: SnekObjects
incomplete
2: Integer
incomplete
3: Float
incomplete
4: String
incomplete
5: Vector3
incomplete
6: Array
incomplete
7: Set
incomplete
8: Get
incomplete
9: Length
incomplete
10: Add
incomplete
This lesson's interactive features are locked, please to keep using them
Now that we have all sorts of Snek Objects (integers, floats, strings, arrays, etc.), we need a convenient way to get the length of any Snek Object. In Python (Sneklang's dreaded competitor) it's as easy as:
print(len(x))
As a Python dev, you don't have to know the value of x ahead of time because Python keeps track of it under-the-hood for you. We want the same capability in Sneklang.
In snekobject.c, complete the snek_length function: