Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

control flow rust

fn main() {
    let mut counter = 0;
    let result = loop {
        counter += 1;

        if counter == 10 {
            break counter * 2;
        }
    };

    println!("The result is {}", result);
}
Source by blog.edfloreshz.dev #
 
PREVIOUS NEXT
Tagged: #control #flow #rust
ADD COMMENT
Topic
Name
1+6 =