#![allow(unused)]
fn main() {
struct EntierASelectionner(i32, bool);
let i = EntierASelectionner(5, false);
}
#![allow(unused)]
fn main() {
struct Point {
x: i32,
y: i32
}
let p = Point {x: 5, y: 2};
}
#![allow(unused)]
fn main() {
struct Point {
x: i32,
y: i32
}
let p = Point {x: 5, y: 2};
println!("{}", p.x);
}
#![allow(unused)]
fn main() {
struct Point {
x: i32,
y: i32
}
impl Point {
fn unitX() -> Point {
return Point(1, 0)
}
fn norm2(&self) -> i32 {
return self.x ** 2 + self.y ** 2;
}
}
let u = Point::unitX();
let p = Point {x: 5, y: 2};
println!("{}", p.norm2());
}