improving scope(finally/success)

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 3 07:24:50 PST 2015


You can already do it with a slight change, and it's not so painful, at 
least in simple functions:

int foo(bool b) {
  auto result = 2;
  scope(exit) writeln(result);
  if (b) {
    result = 1;
  }
  return result;
}


More information about the Digitalmars-d mailing list