Skip to content

Structs

Julius Paffrath edited this page Jun 27, 2026 · 4 revisions

Introduction

A struct is a data type gathering around other variables, called fields:

struct Car
    set name to ""
    set hp   to 0
endstruct

set bmw to Car(name = "BMW", hp = 120)

print("I am driving a " + bmw->name + " with " + bmw->hp + " HP!")

Structs are, like lists, immutable. In order to update a field, the struct has to be copied:

set bmw to bmw update name = "Mercedes" update hp = 218

Clone this wiki locally