mirror of
				https://github.com/Dummi26/mers.git
				synced 2025-10-31 03:45:26 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			472 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			472 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
| // 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
 | |
| 
 | |
| my_struct := [12, "test"]
 | |
| 
 | |
| my_struct.count().debug()
 | |
| 
 | |
| my_struct.note().debug()
 | |
| 
 | |
| &my_struct.note() = "changed"
 | |
| 
 | |
| my_struct.note().debug()
 | 
