On Wednesday, 18 December 2024 at 22:16:45 UTC, John Dougan wrote:
[...]
which isn't what I want. The case for `test(1)` is fine. For
`test(2))` I want the `scope exit 2` to come after the `F`.
```
int test(int val)
{
writeln("A");
if (val % 2 == 0)
{
writeln("b");
scope (exit)
writeln("scope exit ", val);
writeln("c");
writeln("F");
}
else
writeln("F");
return 2 * val;
}
```
results in
```
== start =========================
A
F
== 2 ==============================
A
b
c
F
scope exit 2
== end ===========================
```
Is there a way to tell it that I want to use an enclosing scope
or make it ignore the scope on the `if`?
Pardon, can you rephrase your question?