mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
.
This commit is contained in:
parent
5ce10144e7
commit
9137392326
9
examples/struct_fields.mers
Normal file
9
examples/struct_fields.mers
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// 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
|
Loading…
Reference in New Issue
Block a user