Beeflang - open source performance-oriented compiled programming language
Basile B.
b2.temp at gmx.com
Thu Jan 9 18:15:58 UTC 2020
On Thursday, 9 January 2020 at 17:41:31 UTC, jmh530 wrote:
> On Thursday, 9 January 2020 at 17:19:38 UTC, Gregor Mückl wrote:
>> [...]
>
> I think his point is that do {} while(false) is basically a
> non-looping do statement. So you can use breaks within it like
> below (adapting the example from beeflang.org). The only
> difference I can see is that you can return from Beef's do
> statement. There's probably a way to do that in D, but I
> haven't thought a lot about it.
>
> void main() {
> int result;
> do {
> int c = 2;
> if (c == 0)
> break;
> string op = "+";
> if (op != "+")
> break;
> int c2 = 3;
> if (c2 == 0)
> break;
> result = c + c2;
> } while (false);
> assert(result == 5);
> }
Yes that. Thanks for clarifying my point.
More information about the Digitalmars-d
mailing list