Create an example of a for loop that iterates from 1 to 10 which skips the number 5
fn main(){
for x in 1..11{ // 11 is not inclusive
if x==5 {
continue;
}
println!(“x is {}”,x);
}
}
GIve the syntax of a while loop
let mut x = 10;
while statement {
//come code here
}
Give an example of a loop statement
let mut x = 10;
loop {
}