blob: 9d73d1aadff90d34f9a0363d1635595c913d300d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import "!stdlib.src";
/* declare new struct type */
let test = struct {
x: i64,
y: *i8,
z: bool
};
let main = () => i64 {
/* instanciate new struct. instanciating fields isn't supported here */
let inst = test{};
inst.x = 2;
inst.y = "hello";
inst.z = true;
println("Inst x: %d", inst.x);
println("Inst y: %s", inst.y);
println("Inst z: %d", inst.z);
return 0;
};
/*
Expected stdout:
2
hello
1
Expected return: 0
*/
|