mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-03 09:19:18 +00:00
18 lines
336 B
Rust
18 lines
336 B
Rust
// functions2.rs
|
|
//
|
|
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
|
|
// hint.
|
|
|
|
fn main() {
|
|
call_me(5);
|
|
}
|
|
|
|
fn call_me(num: i32) {
|
|
let big = if num > 0 { num } else {0};
|
|
let small = if num < 0 { num } else {0};
|
|
|
|
for i in small..big {
|
|
println!("Ring! Call number {}", i + 1);
|
|
}
|
|
}
|