Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's idiomatic in Rust, even:

   let result = {
       let b = foo(a);
       let mut c = b.see();
       while (c) {
         c.frob();
       }
       baz(c)
   };



Although the style described above will also work just fine:

    let result;
    {
        let b = foo(a);
        let mut c = b.see();
        while (c) {
          c.frob();
        }
        result = baz(c);
    }




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: