edlang/lib/edlang_driver/tests/programs/struct.ed

19 lines
215 B
Rust
Raw Normal View History

2024-02-18 09:40:19 +00:00
2024-03-13 11:24:40 +00:00
struct Hello {
a: i32,
b: i64,
}
2024-02-18 09:40:19 +00:00
2024-03-13 11:24:40 +00:00
pub fn main() -> i64 {
2024-05-07 07:11:44 +00:00
let mut x: Hello = Hello {
2024-03-13 11:24:40 +00:00
a: 2,
b: 3,
};
hello(&mut x);
return x.b;
}
2024-02-18 09:40:19 +00:00
2024-03-13 11:24:40 +00:00
pub fn hello(a: &mut Hello) {
a.b = 5;
2024-02-18 09:40:19 +00:00
}