This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt::Display; | |
struct Student { | |
name: String, | |
family_name: String, | |
} | |
impl Student { | |
fn new(name: &str, family_name: &str) -> Self { | |
Self { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Repeater { | |
target: i32, | |
repeated: i32, | |
max_repeats: i32, | |
} | |
impl Repeater { | |
fn new(target: i32, max_repeats: i32) -> Self { | |
Self { | |
target, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait FullName { | |
fn full_name(&self) -> String; | |
} | |
struct Student { | |
name: String, | |
family: String, | |
grade: String, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut evens = vec![]; | |
let mut counter = 0; | |
while counter < 100 { | |
if counter % 2 != 0 { | |
counter += 1; | |
continue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut evens = vec![]; | |
let mut counter = 0; | |
loop { | |
if counter >= 100 { | |
break; | |
} |