News for hackers. Stuff that matters.
Re:A function decorator that rewrites the bytecode to enable... by chrismorgan on Tuesday September 21, 2021 @12:35AM (#28602077)
And in most C-style languages that don’t have labelled blocks like this, you can use an infinite loop to achieve the same effect; for example, in Rust where labelled blocks aren’t yet stable:

  'label: loop {
      break 'label;
  }
And if you want to go one further on that, you can break with value because Rust is expression-oriented:

  fn main() {
      println!("Hello, {}!", 'label: loop {
          break 'label "world";
      });
  }

There are no comments on this comment yet.