blob: 62e5982c18590a6966a18408590eb51271b36ba4 [file] [edit]
LL| |#![feature(coverage_attribute)]
LL| |//@ edition: 2024
LL| |
LL| |// Basic test for `while` expressions.
LL| |
LL| 1|fn while_with_tail_expr() {
LL| 1| let mut x = 5;
LL| 6| while x > 0 {
LL| 5| x -= 1;
LL| 5| say("decreased x")
LL| | }
LL| 1| say("goodbye");
LL| 1|}
LL| |
LL| 1|fn while_with_tail_stmt() {
LL| 1| let mut x = 5;
LL| 6| while x > 0 {
LL| 5| x -= 1;
LL| 5| say("decreased x");
LL| | }
LL| 1| say("goodbye");
LL| 1|}
LL| |
LL| |#[coverage(off)]
LL| |fn main() {
LL| | while_with_tail_expr();
LL| | while_with_tail_stmt();
LL| |}
LL| |
LL| |#[coverage(off)]
LL| |fn say(msg: &str) {
LL| | println!("{msg}");
LL| |}