If you have a pre-existing struct, you can define functions that the struct datatype can use
struct Number {
odd : bool,
value : i32,
}
impl Number {
fn isPositive(self){
self.value > 0;
}
}
If you have a pre-existing struct, you can define functions that the struct datatype can use
struct Number {
odd : bool,
value : i32,
}
impl Number {
fn isPositive(self){
self.value > 0;
}
}