mers/examples/struct_fields.mers
2023-06-04 22:22:46 +02:00

10 lines
332 B
Plaintext

// mers doesn't have structs, so instead we define a type:
type myStruct [
int,
string
]
to give names to the fields, we define functions:
fn count(s myStruct) s.0
// to allow users to change the value, add &myStruct to the valid types for s (only through references can values be changed)
fn note(s myStruct/&myStruct) s.1