summaryrefslogblamecommitdiff
path: root/meap/meap-code/ch10/ch10-callstack/src/main.rs
blob: cbb56e36fb5af0f1c55c9990bcec60f8ddc609f3 (plain) (tree)




















                                         
fn print_depth(depth:usize) {
    for _ in 0..depth {
        print!("#");
    }
    println!("");
}

fn dive(depth: usize, max_depth: usize) {
    print_depth(depth);
    if depth >= max_depth {
        return;

    } else {
        dive(depth+1, max_depth);
    }
    print_depth(depth);
}

fn main() {
    dive(0, 5);
}