Add gescription related break statement

Insert description related to break statement.
This commit is contained in:
Anatolij 2018-09-20 13:04:31 +02:00 committed by GitHub
parent cd6abe0bfc
commit 501828c891
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -260,13 +260,16 @@ fn main() {
// `while` loop // `while` loop
while 1 == 1 { while 1 == 1 {
println!("The universe is operating normally."); println!("The universe is operating normally.");
break; // break statement gets out of the while loop.
// It avoids useless iterations.
break
} }
// Infinite loop // Infinite loop
loop { loop {
println!("Hello!"); println!("Hello!");
break; // break statement gets out of the loop
break
} }
///////////////////////////////// /////////////////////////////////