Structs in Karel
This Person
class has name
and age
fields.
new_person
constructs a new Person
object with the given name.
This syntax creates a new class instance.
You can name the fields when initializing a class instance.
Omitted fields will have their default values.
In Python, you do not need to explicitly use a pointer. The Python interpreter handles object references and memory management automatically.
Access class fields using dots.
You can mutate class fields.
In Python, you can use dictionaries for simple data structures.
Next example: Methods.