Content-Length: 12919 | pFad | https://doc.rust-lang.org/reference/../std/../std/vec/../sync/../rc/../../error_codes/./E0267.html

E0267 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0267

A loop keyword (break or continue) was used inside a closure but outside of any loop.

Erroneous code example:

#![allow(unused)]
fn main() {
let w = || { break; }; // error: `break` inside of a closure
}

break and continue keywords can be used as normal inside closures as long as they are also contained within a loop. To halt the execution of a closure you should instead use a return statement. Example:

#![allow(unused)]
fn main() {
let w = || {
    for _ in 0..10 {
        break;
    }
};

w();
}








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/reference/../std/../std/vec/../sync/../rc/../../error_codes/./E0267.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy