

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
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
Sneklang needs floats (obviously). How else will all the crypto bros write weird floating-point bugs into their smart contracts?
So how do we store both floats and ints into the same type?
We're going to use the union and enum features in C to be able to do this, just like we discussed in previous chapters. You will need to extend the existing snek_object_kind_t and snek_object_data_t types to be able to include both ints and floats (and we will continue to add more types in the following chapters to exercise your newfound mastery of memory management).
You will need to edit 2 files in this lesson! snekobject.c and snekobject.h.