In this tutorial we are going to learn about if else statement in rust language
fn main(){
let num = 10;
if num < 10 {
println!("Given number is less than 10");
} else if num == 10{
println!("Given number is 10");
}else {
println!("Given number is grater than 10");
}
}
if else statement in rust look something like this , you can apply logic according to your requirement.
Thanks
No comments:
Post a Comment